Bug 473363 - system-config-network crashes when i set MTU
system-config-network crashes when i set MTU
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: system-config-network (Show other bugs)
10
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Harald Hoyer
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-27 19:42 EST by Ramsey Haddad
Modified: 2009-02-17 12:56 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-02-17 12:56:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ramsey Haddad 2008-11-27 19:42:26 EST
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 01:27:36 EST
Same problem here.
Comment 2 Jeremy Faith 2008-11-28 06:04:37 EST
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 11:23:45 EST
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 12:56:58 EST
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.

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