Bug 154353 - ifup-routes fails to ignore commented lines.
Summary: ifup-routes fails to ignore commented lines.
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
: 81821 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-04-10 21:14 UTC by Terje Bless
Modified: 2014-03-17 02:53 UTC (History)
2 users (show)

Fixed In Version: 8.08-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-04-13 03:43:10 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
route-eth0 that tickles both of the poor comment handling bits of ifup-routes. (104 bytes, text/plain)
2005-04-10 21:14 UTC, Terje Bless
no flags Details
Ignore comments in route-eth0 files. (668 bytes, patch)
2005-04-10 21:17 UTC, Terje Bless
no flags Details | Diff
a better patch (1.10 KB, patch)
2005-04-11 20:42 UTC, Bill Nottingham
no flags Details | Diff
Modified patch to ignore comments and blank lines. (666 bytes, patch)
2005-04-12 15:01 UTC, Terje Bless
no flags Details | Diff
Modified patch to ignore comments and blank lines. (661 bytes, patch)
2005-04-12 15:08 UTC, Terje Bless
no flags Details | Diff

Description Terje Bless 2005-04-10 21:14:05 UTC
The ifup-routes script from initscripts-8.07-1 fails to ignore comment lines in
"route-<interface>" files, and chokes if a mix of old and new syntax is in use.

If any "ADDRESSn" lines are found in the file, despite being commented out,
ifup-routes will assume "newer" syntax is in use and feed it to handle_file.

The handle_file function sources the file, which in effect ignores comments,
and will then fail if any uncommented "older" syntax lines are present (they
will get treated as commands instead of arguments to "/sbin/ip route add").


Once the test for syntax version is fixed to ignore comments, the parsing of
the "older" syntax needs to be modified in a similar fashion; otherwise it
will attempt to pass stuff like "#ADDRESS0=1.2.3.4" as arguments to
"/sbin/ip route add" (which will obviously fail, noisily).


This is a superset of the problem described in Bug #114548.

Comment 1 Terje Bless 2005-04-10 21:14:05 UTC
Created attachment 112932 [details]
route-eth0 that tickles both of the poor comment handling bits of ifup-routes.

Comment 2 Terje Bless 2005-04-10 21:17:25 UTC
Created attachment 112933 [details]
Ignore comments in route-eth0 files.

The attached patch makes syntax version detection ignore commented lines, and
ditto for the parsing of "older" syntax files.

These are strictly separate issues, but since the patch is all of 20 lines
including context... :-)

Comment 3 Bill Nottingham 2005-04-11 20:42:55 UTC
Created attachment 112992 [details]
a better patch

I'm committing this; it looks simpler and calls less commands.

Comment 4 Bill Nottingham 2005-04-11 20:43:31 UTC
Erm, *fewer* commands. *whack*

Comment 5 Bill Nottingham 2005-04-11 20:45:27 UTC
Will be in 8.08-1.

Comment 6 Terje Bless 2005-04-12 15:01:14 UTC
Created attachment 113021 [details]
Modified patch to ignore comments and blank lines.

Patch #112992 will emit RTNETLINK errors for blank lines, and the ${line##\#}
syntax just makes my head hurt.

This modified patch makes the test also ignore blank lines and uses better
grokkable (regex match) test logic.

Note that the patch is against 8.07-1 since 8.08-1 hasn't hit my mirrors yet.

Comment 7 Terje Bless 2005-04-12 15:08:24 UTC
Created attachment 113024 [details]
Modified patch to ignore comments and blank lines.

*sigh*

And of course I had to leave a leftover "echo" in there. :-(

Comment 8 Bill Nottingham 2005-04-13 03:43:10 UTC
Thanks, added. Will still be in 8.08-1. :)

Comment 9 Bill Nottingham 2005-09-30 18:26:40 UTC
*** Bug 81821 has been marked as a duplicate of this bug. ***


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