Bug 200035

Summary: import from system-config-network-cmd will mangle DEVICE and break the ifcfg interface
Product: Red Hat Enterprise Linux 4 Reporter: Panagiotes M. Petrakis <peter.petrakis>
Component: rhplAssignee: Harald Hoyer <harald>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: high Docs Contact:
Priority: medium    
Version: 4.0CC: atodorov, azelinka, pknirsch
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Due to an error in a parser, having a comment at the same line as the configuration option may have caused this option to be parsed incorrectly. With this update, this error no longer occurs, and lines containing comments are now parsed as expected.
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-24 12:43:04 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:

Description Panagiotes M. Petrakis 2006-07-24 22:32:16 UTC
Description of problem:
If there is a comment after the DEVICE field.
Peforming a network backup then restore changes the field by adding
single quotes aroud the DEVICE name. Which will then break the 
ifcfg interface. 

Version-Release number of selected component (if applicable):
# rpm -qf `which system-config-network-cmd`
system-config-network-tui-1.3.22.0.EL.4.2-1

How reproducible: ALWAYS


Steps to Reproduce:
1. Edit ifcfg-bond0
2. Add a comment at the end of the DEVICE line like this. 

DEVICE=bond0    # My primary failover team
ONBOOT=yes
BOOTPROTO=dhcp
TYPE=Unknown


3. Export the network config
system-config-network-cmd -e > backup.cfg

4. Import network config.
system-config-network-cmd -c -i < backup.cfg

5. Examine ifcfg-bond0. note the comments that were once there are now
gone and that the interface name is surrounded by single quotes.

# cat ifcfg-bond0
DEVICE='bond0   '
ONBOOT=yes
BOOTPROTO=dhcp
TYPE=Unknown


Actual results:
# ifup bond0
ip_tables: (C) 2000-2002 Netfilter core team
/sbin/ifup: line 261: [: /etc/dhclient-bond0: binary operator expected
/sbin/ifup: line 291: [: /etc/dhclient-bond0: binary operator expected

Determining IP information for bond0    ...
 failed; no link present.  Check cable?


Expected results:
a) The comments would remain.
b) The DEVICE name would be as it was. 

Additional info:
Editor used in perform this task was vim on a freshly installed
system, RHEL4 beta2. No additional editor settings were in use.

The amount of white from the end of the bareword 'bond0' to the
closing single quote was one full tab. This bug occurs with tabs
and expanded spaces. This happens only on the DEVICE line, for example.

DEVICE=bond0
ONBOOT=yes # we're booting here
BOOTPROTO=dhcp
TYPE=Unknown


!! Perform the steps above.

# cat ifcfg-bond0
DEVICE=bond0
ONBOOT=yes # we're booting here
BOOTPROTO=dhcp
TYPE=Ethernet


So the elimination of the comments is inconsistant as to how the other configs
are handled.

Comment 2 RHEL Program Management 2008-10-31 16:43:28 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Comment 8 Jaromir Hradilek 2010-11-09 11:20:34 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:
Due to an error in a parser, having a comment at the same line as the configuration option may have caused this option to be parsed incorrectly. With this update, this error no longer occurs, and lines containing comments are now parsed as expected.

Comment 9 Alexander Todorov 2010-11-12 10:38:58 UTC
qa_ack+

# rpm -q rhpl
rhpl-0.148.6-1

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0  # our main device
BOOTPROTO=dhcp
HWADDR=00:E0:81:45:C0:6A
ONBOOT=yes
TYPE=Ethernet

# system-config-network-cmd -e > backup.cfg 
# system-config-network-cmd -i < backup.cfg 

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE='eth0  '
BOOTPROTO=dhcp
HWADDR=00:E0:81:45:C0:6A
ONBOOT=yes
TYPE=Ethernet


See the spaces between quotes.

Comment 10 Alexander Todorov 2010-11-12 10:42:25 UTC
# rpm -q rhpl
rhpl-0.148.6-2

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0  # primary device
BOOTPROTO=dhcp
HWADDR=00:E0:81:45:C0:6A
ONBOOT=yes
TYPE=Ethernet

# system-config-network-cmd -e > backup.cfg 
# system-config-network-cmd -i < backup.cfg 

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:E0:81:45:C0:6A
ONBOOT=yes
TYPE=Ethernet

Config file looks OK.

# service network restart
Shutting down interface eth0:  [  OK  ]
Shutting down loopback interface:  [  OK  ]
Setting network parameters:  [  OK  ]
Bringing up loopback interface:  [  OK  ]
Bringing up interface eth0:  [  OK  ]


No errors while restarting service. Moving to VERIFIED.

Comment 12 errata-xmlrpc 2010-11-24 12:43:04 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-2010-0910.html