Bug 450427 - bad grep'ing of network configuration scripts
bad grep'ing of network configuration scripts
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Fedora Extras Quality Assurance
: Reopened
Depends On:
  Show dependency treegraph
Reported: 2008-06-08 01:59 EDT by JW
Modified: 2014-03-16 23:15 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-06-09 10:22:16 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description JW 2008-06-08 01:59:05 EDT
Description of problem:
Some init scripts, especially network, attempt to grep parameters out of what
are otherwise source'able shell scripts.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. read /etc/rc.d/init.d/network
Actual results:
1. Not a good look

Expected results:
1. Should be better

Additional info:
At various points in 'network' there are lines such as "eval $(LANG=C fgrep
"DEVICE=" ifcfg-$i)" and worse with grep/sed.

Too bad if ifcfg-ppp1 might source ifcfg-ppp or similar.

Scripts such as ifup very clearly source these config files as shell scripts
(see source_config()).  Why should 'network' goes its own way and handle them

Is "eval $(LANG=C fgrep "DEVICE=" ifcfg-$i)" really nicer than ". ifcfg-$i"?
I don't think so.  It is pointless, ugly, inaccurate, a hack, incredibly bad
form, and totally unnecessary.
Comment 1 Bill Nottingham 2008-06-09 09:46:27 EDT
Having configurations include other configurations is not guaranteed to work,
and never has been. Configurations aren't sources so that they can be found
instead of polluting the environment, as doing otherwise involves playing tricks
with subshells and pipes.
Comment 2 JW 2008-06-09 10:12:20 EDT
So why do ifup-* all invoke 'source_config()' which actually sources the config
files as shell sources.

If what you say is true, then you have exposed an enormous bug in all of those
ifup-* scripts.  They must be changed because of what you have just decreed.

This bug can therefore be restated as: All ifup-* scripts must no longer invoke
source_config() and must instead do some 'LC_All=C grep this and that' so as to
conform to the better way of doing things.

Viva la grep. Down with bash!

Comment 3 Bill Nottingham 2008-06-09 10:22:16 EDT
You misunderstood what I said, but thanks anyway.

If you want to write a patch to source via a subshell and then pass the needed
information back over a pipe (or whatever), go ahead. But configurations that
directly include other configurations are *not* supported, any more than
configurations that define and override functions used by the network scripts.

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