Bug#980566: Crashes with python traceback if parsing ubuntu.csv

Steve McIntyre steve at einval.com
Wed Jan 20 17:49:39 GMT 2021

Package: lsb-release
Version: 10.2019051400
Severity: normal


lsb_release has two ways to work out distribution information, It
first reads the data in /usr/lib/os-release to see if all the info it
needs is there. If not, it falls back to working out the distribution
from the contents of /etc/dpkg/origins/default and then looking for
for more data in the CSV files in /usr/share/distro.info.

I'm working on a derived distribution that *used* to be based on
Ubuntu, but not any longer. We did not have all the required fields in
our version of /usr/lib/os-release (missing VERSION_CODENAME),
triggering a fallback. Due to our history, on some systems the symlink
in /etc/dpkg/origins/default still pointed to ubuntu so the code in
lsb_release.py::get_distro_info() attempted to parse ubuntu.py. It
blew up due to an odd design choice here, trying to force the version
number into a float:

 Traceback (most recent call last):
   File "/usr/bin/lsb_release", line 95, in <module>
   File "/usr/bin/lsb_release", line 59, in main
     distinfo = lsb_release.get_distro_information()
   File "/usr/lib/python3/dist-packages/lsb_release.py", line 356, in get_distro_information
     distinfo = guess_debian_release()
   File "/usr/lib/python3/dist-packages/lsb_release.py", line 246, in guess_debian_release
   File "/usr/lib/python3/dist-packages/lsb_release.py", line 48, in get_distro_info
     RELEASES_ORDER.sort(key=lambda n: float(n[0]))
   File "/usr/lib/python3/dist-packages/lsb_release.py", line 48, in <lambda>
     RELEASES_ORDER.sort(key=lambda n: float(n[0]))
 ValueError: could not convert string to float: '6.06 LTS'

We've since fixed the os-release file *and* the "default" symlink in
our version of base-files so we're not getting crashes, but the code
here is still clearly broken...

-- Package-specific info:

-- System Information:
Debian Release: 10.7
  APT prefers stable-debug
  APT policy: (500, 'stable-debug'), (500, 'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-13-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages lsb-release depends on:
ii  distro-info-data  0.41+deb10u3
ii  python3           3.7.3-1

Versions of packages lsb-release recommends:
ii  apt

Versions of packages lsb-release suggests:
pn  lsb  <none>

-- no debconf information

More information about the Debian-init-diversity mailing list