[Resolvconf-devel] Bug#519364: Further patch

Stefan Monnier monnier at iro.umontreal.ca
Thu Mar 12 04:57:19 UTC 2009


> BTW, the patch below might help take care of the dependency.

The patches below seem to complete it.  At least it now seems to work OK
for me.  /etc/dhcp3/dhclient-enter-hooks.d/resolvconf would probably
also need to replace ${new_domain_search//\\032/ } with something like
$(echo "$new_domain_search" | sed 's/\\032//'), but since I don't use
dhclient, I haven't touched it.


        Stefan


--- /lib/resolvconf/list-records        2006-08-09 09:36:43.000000000 -0400
+++ /tmp/monnier/list-records   2009-03-12 00:50:50.842868010 -0400
@@ -1,5 +1,4 @@
-#!/bin/bash
-# Need bash because we use nullglob, extglob
+#!/bin/sh
 #
 # list-records
 #
@@ -14,6 +13,9 @@
 {
        RSLT=""
        while [ "$1" ] ; do
+               # Only list records of non-zero size
+                [ -s "$1" ] || { shift ; continue ; }
+
                for E in $RSLT ; do
                        [ "$1" = "$E" ] && { shift ; continue 2 ; }
                done
@@ -36,15 +38,18 @@
                /^$/d
                ' /etc/resolvconf/interface-order)"
 fi
-shopt -s nullglob extglob
+
+# `nullglob' is not indispensable since the test for non-empty files
+# will end up stripping away the patterns that don't correspond to an
+# actual file anyway.
+# `extglob' is not indispensable either because it just changes the set of
+# glob patterns that can be used in /etc/resolvconf/interface-order.
+# Ignore any error while processing shopt since they are normal if /bin/sh is
+# not linked to /bin/bash.
+shopt -s nullglob extglob 2>/dev/null || true
+
 # Pathname expansion occurs on the following line resulting, in general,
 # in multiple instances of filenames; duplicates must be removed.
 uniquify $PATTERNS
-RCRDS=""
-for FLNM in $RSLT ; do
-       # Only list records of non-zero size
-       [ -s "$FLNM" ] && RCRDS="${RCRDS}${FLNM}
-"
-done
-echo -n "$RCRDS"
+echo "$RSLT"
 exit 0

--- /etc/resolvconf/update.d/bind       2006-03-08 12:03:13.000000000 -0500
+++ /tmp/monnier/bind   2009-03-12 00:52:01.523302066 -0400
@@ -1,5 +1,4 @@
-#!/bin/bash
-# Need bash because we use ${foo//bar/baz}
+#!/bin/sh
 #
 # Script to update the named options file
 #
@@ -46,7 +45,7 @@
 NMSRVRS=""
 if [ "$RSLVCNFFILES" ] ; then
        uniquify $(sed -n -e 's/^[[:space:]]*nameserver[[:space:]]\+//p' $RSLVCNFFILES)
-       [ "$RSLT" ] && NMSRVRS="${RSLT// /; }; "
+       [ "$RSLT" ] && NMSRVRS="$(echo "$RSLT" | sed 's/ /; /g'); "
 fi
 
 # N.B.: After changing directory we no longer have access to the resolv.conf-type files





More information about the Resolvconf-devel mailing list