Description of problem: Every time when bringing an interface up one gets: /sbin/dhclient-script: line 186: [: '': integer expression expected Running that with 'bash -x' shows that the following happens: .... + add_default_gateway 192.168.2.254 ''\'''\''' + router=192.168.2.254 + metric= + '[' 2 -gt 1 ']' + '[' ''\'''\''' -gt 0 ']' /sbin/dhclient-script: line 186: [: '': integer expression expected .... Why string '' is passed as an argument I really do not know but if this something expected then something like that should make that work: --- /sbin/dhclient-script.orig 2008-08-24 19:31:58.000000000 -0600 +++ /sbin/dhclient-script 2008-08-28 12:40:14.000000000 -0600 @@ -182,10 +182,9 @@ is_router_reachable() { add_default_gateway() { router="${1}" metric="" - - if [ $# -gt 1 ] && [ ${2} -gt 0 ]; then - metric="metric ${2}" - fi + local lmetric + eval "lmetric=${2}" + [ -n "$lmetric" ] && metric=$lmetric if is_router_reachable ${router} ; then ip route replace default via ${router} dev ${interface} ${metric} Currently there are two arguments but the second one does not need to be numeric. Version-Release number of selected component (if applicable): dhcp-4.0.0-22.fc10 How reproducible: always
Opps! The above patch is not correct if the second argument is really a number. The last replacement line should read: [ -n "$lmetric" ] && metric="metric $lmetric" Does 'metric' variable really needs to be global?
Is this problem occurring with dhcp-4.0.0-23.fc10? I had changed the initial setting of metric to: metric="${METRIC:-}" Originally it was: metric="${METRIC:-''}" So metric was getting the value of "''" and interfering with the integer test in add_default_gateway().
dhcp-4.0.0-23.fc10 does not have that issue. Too many quotes in the original. :-) Loosing external doubles in 'metric' initialization would have the same effects. Thanks.
Closing per comment #3.