Bug 79448 - Extraneous Error Message from /sbin/ifup
Extraneous Error Message from /sbin/ifup
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
8.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
: 90858 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-12-11 13:39 EST by Ronald W. Heiby
Modified: 2014-03-16 22:32 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-08-04 00:16:31 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ronald W. Heiby 2002-12-11 13:39:56 EST
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 14:59:08 EST
Can you post your /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-*?
Comment 2 Ronald W. Heiby 2003-01-15 23:19:30 EST
/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 14:14:22 EDT
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 18:34:58 EDT
*** Bug 90858 has been marked as a duplicate of this bug. ***
Comment 5 Aleksey Nogin 2003-06-11 18:36:08 EDT
Still there in Rawhide with initscripts-7.24-1
Comment 6 Dale R. Worley 2003-08-03 14:04:30 EDT
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 00:16:31 EDT
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.