Bug 173725 - system-config-network corrupts /etc/hosts
Summary: system-config-network corrupts /etc/hosts
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: system-config-network
Version: 5
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Harald Hoyer
QA Contact:
URL:
Whiteboard:
Depends On: 198898
Blocks: 87718
TreeView+ depends on / blocked
 
Reported: 2005-11-19 18:34 UTC by Anthony Green
Modified: 2008-01-11 22:20 UTC (History)
0 users

Fixed In Version: 1.4.7-1.fc8
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-01-11 22:20:45 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Anthony Green 2005-11-19 18:34:44 UTC
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()
+        profilelist.save()
         profilelist.setChanged(false)
         self.appBar.pop()



Version-Release number of selected component (if applicable):
system-config-network-1.3.26-1

How reproducible:
Always

Steps to Reproduce:
1.Go to the Hosts tab.
2.Add some hosts
3.Save
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)
7.Save 
8.Look in /etc/hosts again, and you should be missing an entry
9.Save
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 17:24:31 UTC
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 17:58:40 UTC
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 20:44:49 UTC
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 22:20:25 UTC
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.