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.
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 distro- info/ubuntu. csv' file on the 4th line because of the
'/usr/share/
'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: info('Ubuntu' ).
For the crash to occur, get_distro_info should be called with arg 'Ubuntu',
get_distro_
If we grep lsb source package, we can see that get_distro_info is called only in release( ): distro_ info(distinfo[ 'ID'])
two places.
The first in lsb_release.py:58 with no arguments and the second in lsb_release.py:288
in function
guess_debian_
...get_
The function guess_debian_ release( ) is only called from get_distro_ information( ), lsb_release.py:393. os-release' file and returns a dictionary with the file contents. release( ) is to pass through the guard
If we look into this function, it initially calls get_os_release(), which is reading the
'/usr/lib/
After this, the only way to call guess_debian_
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.