Bug 154353

Summary: ifup-routes fails to ignore commented lines.
Product: [Fedora] Fedora Reporter: Terje Bless <link>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: jos, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 8.08-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-04-13 03:43:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
route-eth0 that tickles both of the poor comment handling bits of ifup-routes.
none
Ignore comments in route-eth0 files.
none
a better patch
none
Modified patch to ignore comments and blank lines.
none
Modified patch to ignore comments and blank lines. none

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. ***