My (Ubuntu Breezy x86_64) machine barfs with:
...
286, in Generator
_NIC = NICInformation ()
File
"/home/rossg/gnue/gnue-svn/.cvsdevelbase/gnue/common/utils/uuid.py",
line 148, in __init__
self.hwaddresses = [self.getHWAddress (i) for i in self.interfaces]
File
"/home/rossg/gnue/gnue-svn/.cvsdevelbase/gnue/common/utils/uuid.py",
line 185, in getHWAddress
data = fcntl.ioctl (sfhd.fileno (), self.SIOCGIFHWADDR, ifreq)
IOError: [Errno 19] No such device
I've found the attached patch, which uses safer (?) alternative code to
enumerate the interfacegnus, to work for me :) Hope it helps.
--
Ross
Index: src/utils/uuid.py
===================================================================
--- src/utils/uuid.py (revision 8104)
+++ src/utils/uuid.py (working copy)
@@ -179,7 +179,7 @@
if sys.platform == 'linux2':
sfhd = socket.socket (socket.AF_INET, socket.SOCK_DGRAM)
- ifreq = (interface + '\0' * 32) [:32]
+ ifreq = interface + '\0' * (32 - len(interface))
try:
data = fcntl.ioctl (sfhd.fileno (), self.SIOCGIFHWADDR, ifreq)
@@ -228,23 +228,17 @@
result = []
if sys.platform == 'linux2':
- sfhd = socket.socket (socket.AF_INET, socket.SOCK_DGRAM)
+ f = open("/proc/net/dev")
+ iflist = f.readlines()
+ f.close()
+ for line in iflist:
+ if ':' not in line:
+ continue
+ words=string.split(line,':')
+ ifname, rest = words[0],words[1:]
+ ifname = string.strip(ifname)
+ result.append (ifname)
- try:
- buffer = array.array ('c', '\0' * 1024)
- (addr, length) = buffer.buffer_info ()
- ifconf = struct.pack ("iP", length, addr)
- data = fcntl.ioctl (sfhd.fileno (), self.SIOCGIFCONF, ifconf)
-
- size, ptr = struct.unpack ("iP", data)
- for idx in range (0, size, 32):
- ifconf = buffer.tostring () [idx:idx+32]
- name = struct.unpack ("16s16s", ifconf) [0].split ('\0', 1) [0]
- result.append (name)
-
- finally:
- sfhd.close ()
-
elif sys.platform == 'win32' and _HAS_GETOBJECT:
result = [i for i in GetObject ('winmgmts:').ExecQuery ("SELECT * FROM "
"Win32_NetworkAdapterConfiguration WHERE IPEnabled=True")]
_______________________________________________
Gnue-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnue-dev