Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 173725 - system-config-network corrupts /etc/hosts
system-config-network corrupts /etc/hosts
Product: Fedora
Classification: Fedora
Component: system-config-network (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Harald Hoyer
Depends On: 198898
Blocks: 87718
  Show dependency treegraph
Reported: 2005-11-19 13:34 EST by Anthony Green
Modified: 2008-01-11 17:20 EST (History)
0 users

See Also:
Fixed In Version: 1.4.7-1.fc8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-01-11 17:20:45 EST
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 Anthony Green 2005-11-19 13:34:44 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc4 Firefox/1.0.7

Description of problem:
Changing a host name in the Hosts tab and then using File->Save results in a corrupt /etc/hosts file.  The entry for the host you renamed won't appear in the host list.  Things get even more messed if you continue renaming hosts and saving after that.

There's a logic error in how the host profiles are saved.  Look in NCProfileList.py for ...

# delete all other entries the user has deleted in the UI

..and think about the case when a host is renamed, since all of this logic is driven by host names.

It turns out, however, the if you save _twice_ after editing, things will work out OK - so the following patch appears to work-around the problem.

--- src/netconfpkg/gui/maindialog.py~   2005-03-30 05:59:01.000000000 -0800
+++ src/netconfpkg/gui/maindialog.py    2005-11-19 10:15:25.000000000 -0800
@@ -402,6 +402,7 @@
         self.appBar.push(_("Saving profile configuration..."))
         profilelist = getProfileList()
+        profilelist.save()

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

How reproducible:

Steps to Reproduce:
1.Go to the Hosts tab.
2.Add some hosts
4.Look in /etc/hosts, and you should see your new hosts
5.Now, pick a host and hit Edit.
6.Change the host name (I've been changing the aliases as well, but that probably has no impact)
8.Look in /etc/hosts again, and you should be missing an entry
10.Look in /etc/hosts and it should look OK.


Additional info:

I can reproduce with redhat-config-network in RHEL3.  It's probably also in other releases.
Comment 1 Anthony Green 2006-03-05 12:24:31 EST
I see this problem hasn't been fixed yet.

While trying to reproduce it on the latest rawhide, I noticed that you have to
have more than 1 entry in the host list (apart from local host) to reproduce.
Create entries for "foo", "bar", and "baz".  Save & Exit.  Then restart, rename
"bar" to "gar" and Save.  Look in /etc/hosts and you'll only see localhost, foo
and baz.  Save again and gar will appear.

Comment 2 Anthony Green 2006-04-27 13:58:40 EDT
This is still a bug in FC5.  I've updated the Version to FC5.  Is that the right
thing to do?
Comment 3 Fedora Update System 2007-12-06 15:44:49 EST
system-config-network-1.4.7-1.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-network'
Comment 4 Fedora Update System 2008-01-11 17:20:25 EST
system-config-network-1.4.7-1.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

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