Comment 3 for bug 1761341

Revision history for this message
Ioanna Alifieraki (joalif) wrote :

Here is a more detailed analysis of how the bug can occur (analysis based on the focal sources).

lsb_release.py crashes in get_distro_info() function, while parsing
'/usr/share/distro-info/ubuntu.csv' file on the 4th line because of the
'6.06 LTS'. get_distro_info() expects a float (6.06) but finds a string (6.06 LTS).

How do we end up in this code path:
For the crash to occur, get_distro_info should be called with arg 'Ubuntu',
get_distro_info('Ubuntu').

If we grep lsb source package, we can see that get_distro_info is called only in
two places.
The first in lsb_release.py:58 with no arguments and the second in lsb_release.py:288
in function
guess_debian_release():
...get_distro_info(distinfo['ID'])

The function guess_debian_release() is only called from get_distro_information(), lsb_release.py:393.
If we look into this function, it initially calls get_os_release(), which is reading the
'/usr/lib/os-release' file and returns a dictionary with the file contents.
After this, the only way to call guess_debian_release() is to pass through the guard
on line 397:
```if key not in lsbinfo:```
For this condition to be true, the /usr/lib/os-release should be empty or contain unexpected keys.