[Python-modules-team] Bug#984983: python3-networkmanager: crashes on unknown device types (eg. wifi p2p) in >=bullseye

Andreas Henriksson andreas at fatal.se
Thu Mar 11 14:59:38 GMT 2021


Package: python3-networkmanager
Version: 2.1-2
Severity: serious
Justification: Incompatibility with bullseye NM causes crashes enumerating devices etc.

Dear Maintainer,

I'm experiencing python3-networkmanager crashing with a simple test
program like this:

$ cat /tmp/test.py
#!/usr/bin/python3

import NetworkManager

for dev in NetworkManager.NetworkManager.Devices:
    if dev.DeviceType == NetworkManager.NM_DEVICE_TYPE_WIFI:
        print(dev)

print("Program finished")
$ python3 /tmp/test.py
Traceback (most recent call last):
  File "/tmp/test.py", line 6, in <module>
    for dev in NetworkManager.NetworkManager.Devices:
  File "/usr/lib/python3/dist-packages/NetworkManager.py", line 174, in get_func
    return fixups.to_python(klass, 'Get', name, data, attrib['type'])
  File "/usr/lib/python3/dist-packages/NetworkManager.py", line 555, in to_python
    val = fixups.base_to_python(val)
  File "/usr/lib/python3/dist-packages/NetworkManager.py", line 612, in base_to_python
    return [fixups.base_to_python(x) for x in val]
  File "/usr/lib/python3/dist-packages/NetworkManager.py", line 612, in <listcomp>
    return [fixups.base_to_python(x) for x in val]
  File "/usr/lib/python3/dist-packages/NetworkManager.py", line 625, in base_to_python
    return globals()[classname](val)
  File "/usr/lib/python3/dist-packages/NetworkManager.py", line 353, in __new__
    klass = device_class(obj.Get('org.freedesktop.NetworkManager.Device', 'DeviceType', dbus_interface='org.freedesktop.DBus.Properties'))
  File "/usr/lib/python3/dist-packages/NetworkManager.py", line 373, in device_class
    return {
KeyError: dbus.UInt32(30, variant_level=1)


The reason appears to be that NM in bullseye supports and returns a
(disconnected=30) wifi p2p interface on my device.

Here's some info from the affected system:

$ nmcli d
DEVICE         TYPE      STATE         CONNECTION
wlan0          wifi      connected     FOOBAR
p2p-dev-wlan0  wifi-p2p  disconnected  --
lo             loopback  unmanaged     --


The mere existance of p2p-dev-wlan0 causes the crash and the needed constant
values in python3-networkmanager was added in new upstream release 2.2.

FWIW the problem is also reproducible on a buster system with a partial
update to NM (and deps) from bullseye. The p2p feature is thus not a new
kernel feature or similar, simply new info exposed by NM.

As mentioned, this is fixed in upstream release 2.2.
I've also filed a pre-approval request to update to 2.2 during freeze,
see Bug#984925

Regards,
Andreas Henriksson



More information about the Python-modules-team mailing list