[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#572008: udhcpc: bash-ism in default.script

Package: udhcpc
Version: 1:1.15.3-1
Severity: important
Tags: patch

My /bin/sh is dash. Running udhcpc yields:

  $ sudo udhcpc -fi wlan0
  udhcpc (v1.15.3) started
  Sending discover...
  Sending select for
  Lease of obtained, lease time 864000
  /usr/share/udhcpc/default.script: Resetting default routes
  SIOCDELRT: No such process
  /usr/share/udhcpc/default.script: 62: arithmetic expression: expecting primary: "metric++"

The problem is that dash does not understand arithmetic increment, like
$((metric++)). The attached patch uses metric=$((metric+1)) instead.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-trunk-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages udhcpc depends on:
ii  busybox                       1:1.15.3-1 Tiny utilities for small and embed

udhcpc recommends no packages.

udhcpc suggests no packages.

-- no debconf information
diff --git a/debian/tree/udhcpc/usr/share/udhcpc/default.script b/debian/tree/udhcpc/usr/share/udhcpc/default.script
index d0ffcd7..105bb74 100755
--- a/debian/tree/udhcpc/usr/share/udhcpc/default.script
+++ b/debian/tree/udhcpc/usr/share/udhcpc/default.script
@@ -19,7 +19,8 @@ case $1 in
 	    for i in $router; do
-		/sbin/route add default gw $i dev $interface metric $((metric++))
+		/sbin/route add default gw $i dev $interface metric $metric
+		metric=$((metric+1))

Reply to: