Net::DNS 0.77 / resolv.conf with comments (was: FreeBSD Port: spamassassin-3.4.0_11)

Michael Grimm trashcan at odo.in-berlin.de
Sat Jun 28 17:01:09 UTC 2014


On 28.06.2014, at 15:50, Michael Grimm <trashcan at odo.in-berlin.de> wrote:

> spamassassin-3.4.0_11 and p5-Net-DNS-0.76 worked as expected. After upgrading to p5-Net-DNS-0.77 I ran into an issue that looked similar to the one reported above. spamd couldn't be daemonized at start-up (timed out). After some investigations I found the reason why spamd didn't start after upgrading to p5-Net-DNS-0.77:
> 
> /etc/resolv.conf
> 	nameserver	1.2.3.4		# some comment
> 	nameserver	8.8.8.8		# another comment
> 
> That has been accepted by p5-Net-DNS-0.76, but for p5-Net-DNS-0.77 I had to remove the comments:
> 
> /etc/resolv.conf
> 	nameserver	1.2.3.4
> 	nameserver	8.8.8.8
> 
> After removing those comments spamassassin-3.4.0_11 and p5-Net-DNS-0.77 run as expected.
> 
> Is this a bug or a feature?

Well, it seems to be a feature :-(

--- /usr/local/lib/perl5/site_perl/5.16/mach/Net/DNS/Resolver/Base.pm	2014-06-13 23:02:31.000000000 +0200
+++ Base.pm--0.76-way-to-read-resov.conf	2014-06-28 18:31:06.492446355 +0200
@@ -234,6 +234,10 @@
 	local $_;
 
 	while (<FILE>) {
+		s/\s*[;#].*$//;					# strip comment
+		next unless m/\S/;				# skip empty line
+		s/^\s+//;					# strip leading space
+
 		/^nameserver/ && do {
 			my ( $keyword, @ip ) = split;
 			push @ns, map { $_ eq '0' ? '0.0.0.0' : $_ } @ip;

Applying this patch, and p5-Net-DNS-0.77 will deal with trailing comments in resolv.conf keywords.

Regards,
Michael


More information about the freebsd-ports mailing list