Bug 114548 - ifup-routes no longer allows comments in route definition files
ifup-routes no longer allows comments in route definition files
Status: CLOSED DUPLICATE of bug 190395
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: initscripts (Show other bugs)
3.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Miloslav Trmač
Brock Organ
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-01-29 09:23 EST by Nick Strugnell
Modified: 2007-11-30 17:07 EST (History)
4 users (show)

See Also:
Fixed In Version: RHBA-2005-607
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-05-01 17:57:29 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)
patch for this issue (893 bytes, patch)
2005-04-11 16:46 EDT, Bill Nottingham
no flags Details | Diff

  None (edit)
Description Nick Strugnell 2004-01-29 09:23:33 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030922

Description of problem:
/etc/sysconfig/network-scripts/ifup-routes is invoked to add static
routes when interfaces are brought up. It handles 'old' (pre RHEL
3/RHL 9) and new format files defining the routes, however it no
longer handles comments in old-style route definition files.

This breaks systems that have been migrated from RHEL 2.1.



Version-Release number of selected component (if applicable):
7.31.9.EL-1

How reproducible:
Always

Steps to Reproduce:
1. create an 'old-style' file e.g.:
/etc/sysconfig/network-scripts/route-eth0 as:
129.16.30.196/32 dev eth0
2. Add a hashed-out comment
3. Try to bring up interface
    

Actual Results:  'ip route add' in ifup-routes throws an error

Expected Results:  ifup-routes should work

Additional info:
Comment 1 Terje Bless 2005-04-10 17:19:21 EDT
This is still present as of RHEL4 as well as initscripts-8.07-1 in Fedora Core
Rawhide today. Bug #154353 deals with a superset of this issue and has a
possible patch.
Comment 2 Bill Nottingham 2005-04-11 16:46:13 EDT
Created attachment 112994 [details]
patch for this issue

Please try the attached.
Comment 8 Bill Nottingham 2005-07-01 17:10:31 EDT
Fixed in 7.31.24.EL-1 for RHEL 3.
Comment 9 Bill Nottingham 2005-07-01 17:16:06 EDT
Fixed in 7.93.14.EL-1 for RHEL-4.
Comment 10 Red Hat Bugzilla 2005-09-28 11:53:31 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-606.html
Comment 11 Red Hat Bugzilla 2005-10-05 11:45:20 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-607.html
Comment 12 Dag Wieers 2006-04-13 05:54:14 EDT
Does this errata fix it only for old-style route-<if> files ?

I am still not able to add comments on a new-style route-<if> on RHEL3AS U7.

One of the advantages of text config-files on Unix, is that one can add comments
in configuration files in order to work together much more efficiently.

For each comment like:

    ### Route to NTP servers (ntpserver1 and ntpserver2)
    1.2.3.0/24 via 4.3.2.1

I see an error like:

    Apr 12 14:29:33 server1 ifup: Error: an inet prefix is expected rather than
"###". 
    Apr 12 14:29:33 server1 ifup: RTNETLINK answers: No such device 
Comment 13 Björn Augustsson 2006-04-13 07:07:38 EDT
Just to clarify: The excerpt you showed is from an old-style file. New ones look
kind of like the ifcfg-<if> files, with entries like

    ADDRESSn=<network>
    NETMASKn=<network/prefix mask>
    GATEWAYn=<next-hop router/gateway IP address>

But anyway, I can reproduce your problem as well on RHEL3

RHEL 4 (where I can't reproduce it) has

           # older format
           while read line; do
               if [[ ! "$line" =~ '^[[:space:]]*(\#.*)?$' ]]; then
                   /sbin/ip route add $line
               fi
           done < "$file"

and RHEL3 has 

           # older format
           while read line; do
               if [ "$line" == "${line##[[:space:]]*\#}" ]; then
                   /sbin/ip route add $line
               fi
           done < "$file"

bash in rhel3 hasn't got the "=~" operator, so it's not that easy though.

/August, also ran into this, the original bug report stems from an install RH
did here.
Comment 14 Bill Nottingham 2006-04-13 09:25:36 EDT
I suspect that just changing it to:

 if [ "$line" == "${line##\#}" ]; then
...

as in the original patch will fix it for you?
Comment 15 Björn Augustsson 2006-04-13 09:42:23 EDT
Works for me.

/August.
Comment 19 Miloslav Trmač 2006-05-01 17:57:29 EDT

*** This bug has been marked as a duplicate of 190395 ***

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