Bug 664091

Summary: Special symbol '#' appears in interface names and confuses scripts.
Product: Red Hat Enterprise Linux 5 Reporter: Matt Domsch <matt_domsch>
Component: initscriptsAssignee: initscripts Maintenance Team <initscripts-maint-list>
Status: CLOSED ERRATA QA Contact: qe-baseos-daemons
Severity: high Docs Contact:
Priority: high    
Version: 5.5CC: azelinka, harald, jbrier, jcm, jonathan, jscotka, linux-bugs, martinez, matt_domsch, mebrown, notting, plautrba, shyam_iyer
Target Milestone: rc   
Target Release: 5.7   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
When the biosdevname sets a name for a PCI device, it uses a "#" character to specify the device interface. Subsequently, when network services were restarted, the network init script returned an error message, such as "ifcfg-ifcfg-pci3#1: No such file or directory" even though the interface itself was properly found. With this update, the network init script parses the "#" character correctly and no error messages are given in the described scenario.
Story Points: ---
Clone Of: 664051 Environment:
Last Closed: 2011-07-21 08:35:18 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:
Bug Depends On: 663904, 663999    
Bug Blocks: 574515, 618260, 660632    

Description Matt Domsch 2010-12-18 02:43:06 UTC
Cloning into RHEL5, as I'm building biosdevname in EPEL5 now, but has not been pushed to epel-testing yet.  Same patch looks like it'll work.

+++ This bug was initially created as a clone of Bug #664051 +++

+++ This bug was initially created as a clone of Bug #663904 +++

Description of problem:
biosdevname set a names like 'pci3#1' to interfaces.
Some scripts treats '#' as as special symbol.
It may be better to use sifferent separator, like '_' or '-' (seee patch).


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


How reproducible:
Always, if pci card is in slot


Steps to Reproduce:
1. Insert pci network card
2. create appropriate config file /etc/sysconfig/network-scripts/ifcfg-pciNxM
3. service network restart
  
Actual results:
Interface appears up, but some errors shown:
grep: ifcfg-ifcfg-pci3#1: No such file or directory

Expected results:
Scripts works w/o errors.


Additional info:
There are some old 3-rd party scripts, so it may be better not to fix scripts, but use different separator.

--- Additional comment from atu.ua on 2010-12-17 04:55:46 EST ---

Created attachment 469322 [details]
User symbol '_' as a separator

--- Additional comment from matt_domsch on 2010-12-17 08:22:11 EST ---

_ is taken in my scheme, to separate NIC partitions & SR-IOV virtual functions.  I'd rather fix the scripts to allow a # in the name.  Pointers to such scripts?  Was this a rawhide install?

--- Additional comment from matt_domsch on 2010-12-17 09:04:09 EST ---

I can't see a failure when using pci2#1 as an interface name, on a Fedora 14 system + biosdevname.  ifup/ifdown work as expected.  Can you provide pointers to the failing scripts on your system?

--- Additional comment from atu.ua on 2010-12-17 09:36:18 EST ---

Some of them - /etc/init.d/network from initscripts.

Problem part:
# bring up all other interfaces configured to come up boot time   
  for i in $interfaces; do
    unset DEVICEYPE SLAVE
    eval $(LANG=C grep -F "DEVICE=" ifcfg-$i)
    eval $(LANG=C grep -F "TYPE=" ifcfg-$i)
    eval $(LANG=C grep -F "SLAVE=" ifcfg-$i)

After this eval's error message appears:
grep: ifcfg-ifcfg-pci3#1: No such file or directory

Really, it seems, that some substitutions requires quoting "".
But it's a too common error.

Real error  in in this lines :
interfaces=$(ls ifcfg* | \
 LANG=C sed -e "$__sed_discard_ignored_files" \
   -e '/\(ifcfg-lo$\|:\|ifcfg-.*-range\)/d' \
   -e '/ifcfg-[A-Za-z0-9\._-]\+$/ { s/^ifcfg-//g;s/[0-9]/ &/}' | \ # HERE!
   LANG=C sort -k 1,1 -k 2n | \
   LANG=C sed 's/ //')


May be some another non bash-special symbol, like '@' '=' ,
and add it to allowed char in all scripts?
Dot '.' and ':' are reserver for VLAN-s and aliases.

--- Additional comment from matt_domsch on 2010-12-17 10:21:45 EST ---

1) the fact that it's grepping ifcfg-ifcfg-pci3#1 (note the duplicate ifcfg parts of the name) is a problem.  I've never seen that before.

2) sounds like an initscripts problem. Re-assigning.  I agree the sed you note with #HERE will need adjustment to accept the new separator # in the match.

--- Additional comment from matt_domsch on 2010-12-17 10:53:25 EST ---

Initscripts patch to add # fixes it:

diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index 482bb7b..b31060b 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -46,7 +46,7 @@ cd /etc/sysconfig/network-scripts
 interfaces=$(ls ifcfg* | \
            LANG=C sed -e "$__sed_discard_ignored_files" \
                       -e '/\(ifcfg-lo$\|:\|ifcfg-.*-range\)/d' \
-                      -e '/ifcfg-[A-Za-z0-9\._-]\+$/ { s/^ifcfg-//g;s/[0-9]/ &/}' | \
+                      -e '/ifcfg-[A-Za-z0-9#\._-]\+$/ { s/^ifcfg-//g;s/[0-9]/ &/}' | \
            LANG=C sort -k 1,1 -k 2n | \
            LANG=C sed 's/ //')
 rc=0



On my system, this results in the interfaces being properly found:
em1 em2 pci2#1

--- Additional comment from matt_domsch on 2010-12-17 10:56:49 EST ---

Created attachment 469405 [details]
0001-add-as-a-valid-characer-in-network-device-names.patch

initscript patch

Comment 1 RHEL Program Management 2011-02-01 17:07:11 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 4 Matt Domsch 2011-02-04 16:23:46 UTC
I changed '#' to 'p' in upstream biosdevname.  This was the largest complaint about fear of breakage.

Comment 9 Tomas Capek 2011-07-13 12:23:46 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When the biosdevname sets a name for a PCI device, it uses a "#" character to specify the device interface. Subsequently, when network services were restarted, the network init script returned an error message, such as "ifcfg-ifcfg-pci3#1: No such file or directory" even though the interface itself was properly found. With this update, the network init script parses the "#" character correctly and no error messages are given in the described scenario.

Comment 10 errata-xmlrpc 2011-07-21 08:35:18 UTC
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 therefore 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-2011-1081.html

Comment 11 errata-xmlrpc 2011-07-21 12:40:15 UTC
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 therefore 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-2011-1081.html