Here's a patch that should be sufficient to close the bug.

If someone has time on their hands, it might be nicer to use debconf to
prompt the user whether to diable mdns, or remove the "search local" line.

-- 
see shy jo
diff -ur old/nss-mdns-0.8/debian/README.Debian nss-mdns-0.8/debian/README.Debian
--- old/nss-mdns-0.8/debian/README.Debian       2006-10-14 16:35:37.000000000 
-0400
+++ nss-mdns-0.8/debian/README.Debian   2006-10-14 16:20:22.000000000 -0400
@@ -11,6 +11,17 @@
 will be preserved. If this package is purged, the mdns items will be
 removed from the hosts line.
 
+PROBLEMS WITH "search local" IN /etc/resolv.conf
+------------------------------------------------
+
+If you have "search local" in /etc/resolv.conf, this will not behave well
+with mdns. In the best case, every hostname lookup will be slowed down as a
+mdns lookup is done first; in the worst case all dns lookups will fail.
+
+The author of nss-mdns does not consider using "search local" with mdns to
+be a supported configuration. Either change /etc/resolv.conf, or remove the
+mdns entries from /etc/nsswitch.conf.
+
 WHAT ABOUT IPv6?
 ----------------
 
diff -ur old/nss-mdns-0.8/debian/changelog nss-mdns-0.8/debian/changelog
--- old/nss-mdns-0.8/debian/changelog   2006-10-14 16:35:37.000000000 -0400
+++ nss-mdns-0.8/debian/changelog       2006-10-14 16:25:21.000000000 -0400
@@ -1,3 +1,16 @@
+nss-mdns (0.8-6) UNRELEASED; urgency=low
+
+  * Document in README.Debian that using "search local" in /etc/resolv.conf
+    does not get along well at all with using mdns in /etc/nsswitch.conf.
+    This is not a supported configuration.
+  * Check for systems that have "search local" in /etc/resolv.conf and use
+    mdns, print a warning, and disable mdns. Do this on upgrade to this
+    version, and on new installs; if you really want the problimatic
+    configuration you can add it back and it will be preserved from now on.
+    Closes: #392813
+
+ -- Joey Hess <[EMAIL PROTECTED]>  Sat, 14 Oct 2006 16:20:25 -0400
+
 nss-mdns (0.8-5) unstable; urgency=low
 
   * Take over the package for the pkg-utopia team. T
diff -ur old/nss-mdns-0.8/debian/postinst nss-mdns-0.8/debian/postinst
--- old/nss-mdns-0.8/debian/postinst    2006-10-14 16:35:37.000000000 -0400
+++ nss-mdns-0.8/debian/postinst        2006-10-14 16:35:01.000000000 -0400
@@ -19,4 +19,39 @@
                        s/^(hosts:\s+)(.*)/$1.insert($2)/e;
                ' /etc/nsswitch.conf
        fi
+
+       if [ -z "$2" ] || dpkg --compare-versions "$2" le 0.8-6; then
+               if [ -e /etc/resolv.conf ] && \
+                  egrep -q  '^ *search *local *$' /etc/resolv.conf && \
+                  grep -q "mdns" /etc/nsswitch.conf; then
+                       cat <<EOF
+* Warning: /etc/resolv.conf contains "search local"
+  and /etc/nsswitch.conf uses mdns. This combination is not supported.
+  Removing mdns from /etc/nsswitch.conf. See
+  /usr/share/doc/libnss-mdns/README.Debian for details.
+EOF
+
+                       perl -i -pe '
+                               my @remove=(
+                                       "mdns4_minimal [NOTFOUND=return]",
+                                       "mdns4_minimal",
+                                       "mdns4",
+                                       "mdns6_minimal [NOTFOUND=return]",
+                                       "mdns6_minimal",
+                                       "mdns6",
+                                       "mdns_minimal [NOTFOUND=return]",
+                                       "mdns_minimal",
+                                       "mdns",
+                               );
+                               sub remove {
+                                       my $s=shift;
+                                       foreach my $bit (@remove) {
+                                               $s=~s/\s+\Q$bit\E//g;
+                                       }
+                                       return $s;
+                               }
+                               s/^(hosts:)(.*)/$1.remove($2)/e;
+                       ' /etc/nsswitch.conf
+               fi
+       fi
 fi

Attachment: signature.asc
Description: Digital signature

Reply via email to