On Wed, 04.10.06 19:02, Joey Hess ([EMAIL PROTECTED]) wrote: A few comments regarding your patch:
> --- old/nss-mdns-0.8/debian/postinst 1969-12-31 19:00:00.000000000 -0500 > +++ nss-mdns-0.8/debian/postinst 2006-10-04 18:58:41.000000000 -0400 > @@ -0,0 +1,23 @@ > +#!/bin/sh > +set -e > +#DEBHELPER# > + > +if [ "$1" = configure ] && [ -e /etc/nsswitch.conf ]; then > + if [ -z "$2" ] || dpkg --compare-versions "$2" le 0.8-4.1; then > + perl -i -pe ' > + sub insert { > + my @bits=split(" ", shift); > + if (grep { $_ eq "mdns4_minimal" || $_ eq > "mdns4" > + || $_ eq "mdns" || $_ eq "mdns_minimal" > } @bits) { There's also mdns6 and mdns6_minimal for those IPv6-only-maniacs. You might want to check for them here, too. BTW, is this fragment executed on package upgrades, too? Would definitely make a lot of sense. > + return join " ", @bits; > + } > + @bits = map { > + $_ eq "files" ? > ($_,"mdns4_minimal","[NOTFOUND=return]") : $_ > + } @bits; > + push @bits, "mdns4"; Hmm. I think it would be a better idea to use "dns" as the single anchor for our changes, instead of "files" and for the end of the list. Why? Because DNS is the reason I split mdns4_minimal from mdns4 in the first place. I didn't document this anywhere but the placement rules for the two modules are: 1. put "mdns4_minimal [NOTFOUND=return]" somewhere before "dns" 2. put "mdns4" somwhere after "dns" In effect this makes no difference for the resulting file if the original nsswitch.conf was still the default. However, if it wasn't (i.e. due to usage of LDAP or any other nss module) this might make a difference. My suggestion: @bits = map { $_ eq "dns" ? ("mdns4_minimal","[NOTFOUND=return]",$_,"mdns4") : $_ } @bits; And it is shorter, too! > + return join " ", @bits; > + } > + s/^(hosts:\s+)(.*)/$1.insert($2)/e; > + ' /etc/nsswitch.conf > + fi > +fi > diff --new-file -ur old/nss-mdns-0.8/debian/postrm nss-mdns-0.8/debian/postrm > --- old/nss-mdns-0.8/debian/postrm 1969-12-31 19:00:00.000000000 -0500 > +++ nss-mdns-0.8/debian/postrm 2006-10-04 18:56:45.000000000 -0400 > @@ -0,0 +1,18 @@ > +#!/bin/sh > +set -e > +#DEBHELPER# > + > +if [ "$1" = purge ] && [ -e /etc/nsswitch.conf ]; then > + perl -i -pe ' > + sub remove { > + my @bits=grep { $_ ne "mdns4_minimal" && > + $_ ne "mdns4" && > + $_ ne "mdns_minimal" && > + $_ ne "mdns" && > + $_ ne "[NOTFOUND=return]" } I am no Perl guru. However, as I understand this, you strip all occurances of [NOTFOUND=return] from the line. That is a really bad idea. That syntax might appear in other contexts too, since it is just a string to make sure that the previously called NSS module is made authoritative. That might be used by LDAP setups and others, too, not just nss-mdns. The strings you should remove are these: "mdns4_minimal [NOTFOUND=return]" "mdns4_minimal" "mdns4" "mdns6_minimal [NOTFOUND=return]" "mdns6_minimal" "mdns6" "mdns_minimal [NOTFOUND=return]" "mdns_minimal" "mdns" (In that order!) Otherwise I am very happy with your patch. Lennart -- Lennart Poettering; lennart [at] poettering [dot] net ICQ# 11060553; GPG 0x1A015CC4; http://0pointer.net/lennart/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]