Bug 473363

Summary: system-config-network crashes when i set MTU
Product: [Fedora] Fedora Reporter: Ramsey Haddad <ramsey.haddad>
Component: system-config-networkAssignee: Harald Hoyer <harald>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 10CC: gordon.messmer, harald, jfaith, jmoskovc, jon.dufresne, netllama
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-02-17 17:56:58 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 Ramsey Haddad 2008-11-28 00:42:26 UTC
In system-config-network, when i check "Set MTU to 1500" for eth0 and I save it crashes and it says to file a bug report.



Component: system-config-network
Version: 1.5.93
Summary: TB334155f4 ConfShellVar.py:66:__setitem__:TypeError: expected string or buffer

Traceback (most recent call last):
  File "/usr/share/system-config-network/netconfpkg/gui/maindialog.py", line 805, in on_activateButton_clicked
    self.activateButtonFunc[self.active_page](button)
  File "/usr/share/system-config-network/netconfpkg/gui/maindialog.py", line 1021, in on_deviceActivateButton_clicked
    if self.save() != 0:
  File "/usr/share/system-config-network/netconfpkg/gui/maindialog.py", line 411, in save
    self.saveDevices()
  File "/usr/share/system-config-network/netconfpkg/gui/maindialog.py", line 431, in saveDevices
    devicelist.save()
  File "/usr/share/system-config-network/netconfpkg/NCDeviceList.py", line 238, in save
    dev.save()
  File "/usr/share/system-config-network/netconfpkg/NCDevice.py", line 413, in save
    conf[confkey] = getattr(self, selfkey)
  File "/usr/share/system-config-network/netconfpkg/conf/ConfShellVar.py", line 66, in __setitem__
    if self.quotereg.search(value):
TypeError: expected string or buffer

Local variables in innermost frame:
varname: MTU
self: <netconfpkg.NCDevice.ConfDevice instance at 0xa75e20c>
place: 2
value: 1500
missing: 1

Comment 1 Lonni J Friedman 2008-11-28 06:27:36 UTC
Same problem here.

Comment 2 Jeremy Faith 2008-11-28 11:04:37 UTC
Problem here is that ConfShellVar __setitem__ it not able to cope with variables that have a numeric value.

/usr/share/system-config-network/netconfpkg/conf/ConfShellVar.py
Adding the following as line 53 fixes the problem by forcing value to be a string
         value='%s'%(value) #ensure value is a string

output from diff -c
*** orig        2008-11-28 10:57:59.000000000 +0000
--- ConfShellVar.py     2008-11-28 11:01:32.000000000 +0000
***************
*** 50,55 ****
--- 50,56 ----
          # prevent tracebacks
          if not value:
              value = ""
+         value='%s'%(value) #ensure value is a string
          # set *every* instance of varname to value to avoid surprises
          place = self.tell()
          self.rewind()

Comment 3 Jeremy Faith 2009-02-03 16:23:45 UTC
Hi,
I just checked to see if this issue has been fixed.
In updates for Fedora 10 there is
  system-config-network-tui-1.5.95-1.fc10.noarch.rpm
which seems to work fine.

The fix seems to be to be in system-config-network/netconfpkg/NCDevice.py
@@ -409,8 +411,8 @@
                                                                                
         for selfkey in self.__intkeydict.keys():
             confkey = self.__intkeydict[selfkey]
-            if hasattr(self, selfkey):
-                conf[confkey] = getattr(self, selfkey)
+            if hasattr(self, selfkey) and getattr(self, selfkey) != None:
+                conf[confkey] = str(getattr(self, selfkey))
             else: del conf[confkey]

It is the str() function call that fixes the problem by ensuring the value is a string, in a similar way to my '%s'%(value) patch.

So I think this issue can be closed as it has already been fixed by someone.

Comment 4 Jon Dufresne 2009-02-17 17:56:58 UTC
Thank you for the bug report. This particular bug was fixed and an updated
package was published for download. If you find that the bug still persists feel free to reopen this bug.

You can obtain the updated package by typing 'yum update <package>' or using
the graphical updater, Software Update.