[Resolvconf-devel] Bug#518359: resolvconf: bug in shell script leads to early exit - resolv.conf is not filled with nameserver entries - with fix

Thorsten Glaser tg at mirbsd.de
Thu Mar 5 17:18:17 UTC 2009


Package: resolvconf
Version: 1.42
Severity: grave
Tags: patch
Justification: renders package unusable

Hello,

the /etc/resolvconf/update.d/libc script contains "set -e", which
means the shell aborts execution if one of the commands returns
a non-zero exit status.

The aforementioned script contains instructions ("[ ... ]") that
do so and thusly fails to work. These familiar with Makefiles,
which exhibit similar behaviour, know to use negative logic, i.e.
[ x != y ] || foo instead of [ x = y ] && foo, instead.

The patch below fixes this problem:

--- /etc/resolvconf/update.d/libc.orig	2009-03-05 17:07:48.000000000 +0000
+++ /etc/resolvconf/update.d/libc	2009-03-05 17:11:10.000000000 +0000
@@ -60,7 +60,9 @@ uniquify()
 	RSLT=""
 	while [ "$1" ] ; do
 		for E in $RSLT ; do
-			[ "$1" = "$E" ] && { shift ; continue 2 ; }
+			[ "$1" = "$E" ] || continue
+			shift
+			continue 2
 		done
 		RSLT="${RSLT:+$RSLT }$1"
 		shift
@@ -76,7 +78,9 @@ uniquify_nameserver_list()
 	N=0
 	while [ "$1" ] ; do
 		for E in $NMSRVRS ; do
-			[ "$1" = "$E" ] && { shift ; continue 2 ; }
+			[ "$1" = "$E" ] || continue
+			shift
+			continue 2
 		done
 		NMSRVRS="${NMSRVRS:+$NMSRVRS }$1"
 		case "$TRUNCATE_NAMESERVER_LIST_AFTER_127" in (y|Y|yes|YES|Yes) case "$1" in (127.*) return 0 ;; esac ;; esac



-- System Information:
Debian Release: 5.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/mksh

Versions of packages resolvconf depends on:
ii  coreutils                     6.10-6     The GNU core utilities
ii  debconf [debconf-2.0]         1.5.24     Debian configuration management sy
ii  lsb-base                      3.2-20     Linux Standard Base 3.2 init scrip

resolvconf recommends no packages.

resolvconf suggests no packages.

-- debconf information:
* resolvconf/linkify-resolvconf: true
* resolvconf/downup-interfaces:
  resolvconf/link-tail-to-original: false





More information about the Resolvconf-devel mailing list