[Touch-packages] [Bug 1761341] Re: lsb_release crashed with ValueError in (): could not convert string to float: '6.06 LTS'

2022-09-19 Thread Ioanna Alifieraki
@mwhudson yes, I am working on the debdiffs and once ready I'll attach
them here.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to lsb in Ubuntu.
https://bugs.launchpad.net/bugs/1761341

Title:
  lsb_release crashed with ValueError in (): could not convert
  string to float: '6.06 LTS'

Status in lsb package in Ubuntu:
  Fix Released
Status in lsb source package in Bionic:
  Confirmed
Status in lsb source package in Focal:
  Confirmed
Status in lsb source package in Jammy:
  Confirmed

Bug description:
  [Description]

  In some cases lsb_release script can crash with the following trace :

  Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 95, in 
  main()
  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
  get_distro_info(distinfo['ID'])
  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 
  RELEASES_ORDER.sort(key=lambda n: float(n[0]))
  ValueError: could not convert string to float: '6.06 LTS

  The root cause of this is that function get_distro_info() while parsing
  the '/usr/share/distro-info/ubuntu.csv' and expects to find a float at the
  beginning of each line, instead it find a string ("6.06 LTS").

  There is a fix for this bug upstream:
  
https://salsa.debian.org/debian/lsb/-/commit/4b36f9d31c00233ea20415542633729ab3799e61
  and is already in kinetic.

  [Test Case]

  The easier way to reproduce this bug is to hack 
/usr/share/pyshared/lsb_release.py file
  change the get_distro_info definition from
  def get_distro_info(origin='Debian'):
  to
  def get_distro_info(origin='Ubuntu'):
  and run
  $ lsb_release
  Traceback (most recent call last):
    File "/usr/bin/lsb_release", line 25, in 
  import lsb_release
    File "/usr/lib/python3/dist-packages/lsb_release.py", line 58, in 
  get_distro_info()
    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 
  RELEASES_ORDER.sort(key=lambda n: float(n[0]))
  ValueError: could not convert string to float: '6.06 LTS'

  
  A detailed analysis on how this bug can happen in a real life scenario
  can be found in comment #3.

  [Regression Potential]

  The fix changes the way get_distro_info function parses the csv file and 
instead of expecting
  a float at the beginning of the line, it now expects a string and isolates 
the numerical part.

  The regression potential is small and would affect the behavior of
  lsb_release executable.

  [Other]

  Debian bug : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980566
  Fix : 
https://salsa.debian.org/debian/lsb/-/commit/4b36f9d31c00233ea20415542633729ab3799e61
  Affected releases : Jammy, Focal, Bionic

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lsb/+bug/1761341/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


[Touch-packages] [Bug 1761341] Re: lsb_release crashed with ValueError in (): could not convert string to float: '6.06 LTS'

2022-09-18 Thread Michael Hudson-Doyle
Ioanna are you going to take care of preparing patches for fixing the
stable releases? I marked the overall/kinetic task as fix released as
you say the bug is no longer present there.

** Changed in: lsb (Ubuntu)
   Status: Confirmed => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to lsb in Ubuntu.
https://bugs.launchpad.net/bugs/1761341

Title:
  lsb_release crashed with ValueError in (): could not convert
  string to float: '6.06 LTS'

Status in lsb package in Ubuntu:
  Fix Released
Status in lsb source package in Bionic:
  Confirmed
Status in lsb source package in Focal:
  Confirmed
Status in lsb source package in Jammy:
  Confirmed

Bug description:
  [Description]

  In some cases lsb_release script can crash with the following trace :

  Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 95, in 
  main()
  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
  get_distro_info(distinfo['ID'])
  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 
  RELEASES_ORDER.sort(key=lambda n: float(n[0]))
  ValueError: could not convert string to float: '6.06 LTS

  The root cause of this is that function get_distro_info() while parsing
  the '/usr/share/distro-info/ubuntu.csv' and expects to find a float at the
  beginning of each line, instead it find a string ("6.06 LTS").

  There is a fix for this bug upstream:
  
https://salsa.debian.org/debian/lsb/-/commit/4b36f9d31c00233ea20415542633729ab3799e61
  and is already in kinetic.

  [Test Case]

  The easier way to reproduce this bug is to hack 
/usr/share/pyshared/lsb_release.py file
  change the get_distro_info definition from
  def get_distro_info(origin='Debian'):
  to
  def get_distro_info(origin='Ubuntu'):
  and run
  $ lsb_release
  Traceback (most recent call last):
    File "/usr/bin/lsb_release", line 25, in 
  import lsb_release
    File "/usr/lib/python3/dist-packages/lsb_release.py", line 58, in 
  get_distro_info()
    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 
  RELEASES_ORDER.sort(key=lambda n: float(n[0]))
  ValueError: could not convert string to float: '6.06 LTS'

  
  A detailed analysis on how this bug can happen in a real life scenario
  can be found in comment #3.

  [Regression Potential]

  The fix changes the way get_distro_info function parses the csv file and 
instead of expecting
  a float at the beginning of the line, it now expects a string and isolates 
the numerical part.

  The regression potential is small and would affect the behavior of
  lsb_release executable.

  [Other]

  Debian bug : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980566
  Fix : 
https://salsa.debian.org/debian/lsb/-/commit/4b36f9d31c00233ea20415542633729ab3799e61
  Affected releases : Jammy, Focal, Bionic

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lsb/+bug/1761341/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp


[Touch-packages] [Bug 1761341] Re: lsb_release crashed with ValueError in (): could not convert string to float: '6.06 LTS'

2022-09-16 Thread Ioanna Alifieraki
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.

** Description changed:

- satana@satana:~$  lsb_release
- LSB Version:  
core-9.20170808ubuntu1-noarch:printing-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
- satana@satana:~$  snap list
- Name  VersionRev   Tracking  Developer  Notes
- core  16-2.32.1  4327  stablecanonical  core
- satana@satana:~$
+ [Description]
  
- ProblemType: Crash
- DistroRelease: Ubuntu 18.04
- Package: lsb-release 9.20170808ubuntu1 [modified: 
usr/share/pyshared/lsb_release.py]
- ProcVersionSignature: Ubuntu 4.15.0-14.15-generic 4.15.15
- Uname: Linux 4.15.0-14-generic x86_64
- ApportVersion: 2.20.9-0ubuntu2
- Architecture: amd64
- Date: Wed Mar 28 15:36:11 2018
- ExecutablePath: /usr/bin/lsb_release
- InstallationDate: Installed on 2016-09-15 (566 days ago)
- InstallationMedia: Ubuntu 14.04.1 LTS "Trusty Tahr" - Release amd64 
(20140722.2)
- InterpreterPath: /usr/bin/python3.6
- PackageArchitecture: all
- ProcCmdline: /usr/bin/python3 -Es /usr/bin/lsb_release -i -s
- Python3Details: /usr/bin/python3.6, Python 3.6.5, python3-minimal, 3.6.5-2
- PythonArgs: ['/usr/bin/lsb_release', '-i', '-s']
- PythonDetails: /usr/bin/python2.7, Python 2.7.14+, python-minimal, 2.7.14-4
- SourcePackage: lsb
- Title: lsb_release crashed with ValueError in (): could not convert 
string to float: '6.06 LTS'
- UpgradeStatus: No upgrade log present (probably fresh install)
- UserGroups:
+ In some cases lsb_release script can crash with the following trace :
+ 
+ Traceback (most recent call last):
+ File "/usr/bin/lsb_release", line 95, in 
+ main()
+ 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
+ get_distro_info(distinfo['ID'])
+ 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 
+ RELEASES_ORDER.sort(key=lambda n: float(n[0]))
+ ValueError: could not convert string to float: '6.06 LTS
+ 
+ 
+ The root cause of this is that function get_distro_info() while parsing
+ the '/usr/share/distro-info/ubuntu.csv' and expects to find a float at the
+ beginning of each line, instead it find a string ("6.06 LTS").
+ 
+ There is a fix for this bug upstream:
+ 
https://salsa.debian.org/debian/lsb/-/commit/4b36f9d31c00233ea20415542633729ab3799e61
+ and is already in kinetic.
+ 
+ [Test Case]
+ 
+ The easier way to reproduce this bug is to hack 
/usr/share/pyshared/lsb_release.py file
+ change the get_distro_info definition from 
+ def get_distro_info(origin='Debian'):
+ to
+ def get_distro_info(origin='Ubuntu'):
+ and run 
+ $ lsb_release
+ Traceback (most recent call last):
+   File "/usr/bin/lsb_release", line 25, in 
+ import lsb_release
+   File "/usr/lib/python3/dist-packages/lsb_release.py", line 58, in 
+ get_distro_info()
+   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 
+ RELEASES_ORDER.sort(key=lambda n: float(n[0]))
+ ValueError: could not convert string to float: '6.06 LTS'
+ 
+ 
+ [Regression Potential]
+ 
+ The fix changes the way get_distro_info function parses the csv file and 
instead of expecting
+ a float at the beginning of the line, it now expects a string and isolates 
the numerical part.
+ 
+ The regression potential is small and would affect the behavior of
+ lsb_release executable.
+ 
+ 
+ [Other]
+ 
+ Debian bug :