Bug 79448 - Extraneous Error Message from /sbin/ifup
Summary: Extraneous Error Message from /sbin/ifup
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 8.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
: 90858 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-12-11 18:39 UTC by Ronald W. Heiby
Modified: 2014-03-17 02:32 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-08-04 04:16:31 UTC
Embargoed:


Attachments (Terms of Use)

Description Ronald W. Heiby 2002-12-11 18:39:56 UTC
Description of Problem:

The /sbin/ifup script generates (on at least one of my systems) an "integer 
expression expected error at line 203. It turns out that $NUMDEFROUTES is 
empty. One potential fix is to add a BEGIN clause to the awk command just 
above, like "BEGIN { nlines=0 }".

How Reproducible:

Seems to always happen on my ThinkPad A21p and one of my HP servers (RH 8.0, 
also). Have not seen it on the (RH 8.0) HP servers that is the DHCP and DNS 
server for the LAN. Apart from the error message, there seems to be no ill 
effect, but non-error error messages should be eliminated where possible.

Steps to Reproduce:
1. /sbin/ifup eth0

Actual Results:
from /var/log/messages:
ifup: ./ifup: line 203: [: : integer expression expected

Expected Results:
no such error message from ifup

Comment 1 Bill Nottingham 2003-01-13 19:59:08 UTC
Can you post your /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-*?

Comment 2 Ronald W. Heiby 2003-01-16 04:19:30 UTC
/etc/sysconfig/network:

NETWORKING=yes
HOSTNAME=falkor

/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
DHCP_HOSTNAME=falkor
USERCTL=no
PEERDNS=yes
TYPE=Ethernet

Comment 3 Shawn Asmussen 2003-04-07 18:14:22 UTC
I have seen this same problem under RedHat 8.0, and now that 9 is out I have 
the same issue under 9. It occurs for me on any machine on a test subnet we 
have setup where the DHCP server does not issue a default route. I agree with 
heiby_rh about the solution. I used the exact same fix of initializing the 
nlines variable in the awk script. 

Comment 4 Aleksey Nogin 2003-06-11 22:34:58 UTC
*** Bug 90858 has been marked as a duplicate of this bug. ***

Comment 5 Aleksey Nogin 2003-06-11 22:36:08 UTC
Still there in Rawhide with initscripts-7.24-1

Comment 6 Dale R. Worley 2003-08-03 18:04:30 UTC
I have seen this problem also.  A specific example is:

    [root@dragon root]# ifup eth1

    Determining IP information for eth1... done.
    /sbin/ifup: line 206: [: : integer expression expected

The immediate cause is that there is no default route present in the routing
table while ifup attempts to determine if there is more than one.  E.g., suppose
that eth1 received an address via DHCP but the DHCP server provided it with no
default route.  The code in question is:

    # DHCP likes to create duplicate routes.  Fix that up.
    NUMDEFROUTES=`ip -o route | \
                  grep "^default" | \
                  awk '{ nlines++ } END { print nlines }'`
    if [ -n "$NUMDEFROUTES" -a "$NUMDEFROUTES" -gt 1 ]; then

If there is no default route, then "ip | grep" produces no output, and the awk
expression "nlines++" is never executed, so the value of nlines remains null,
rather than 0.  Adding the awk command "BEGIN { nlines = 0 }" solves the problem.


Comment 7 Bill Nottingham 2003-08-04 04:16:31 UTC
Fixed in CVS, will be in the next build


Note You need to log in before you can comment on or make changes to this bug.