Hi Alberto,

That seems to have worked for me. Thanks!

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to ubuntu-drivers-common in Ubuntu.
https://bugs.launchpad.net/bugs/2019016

Title:
  nvidia_desktop_pre_installation_hook raises on package names with
  suffixes

Status in ubuntu-drivers-common package in Ubuntu:
  New

Bug description:
  The function nvidia_desktop_pre_installation_hook in
  /usr/lib/python3/dist-packages/UbuntuDrivers/detect.py on Ubuntu
  22.04.2 LTS assumes that the driver package name ends with the driver
  version as the suffix.

  However this does not account for the '-open' drivers. The following
  code from that function is at fault:

  ```
      # Enable KMS if nvidia >= 470
      for package_name in to_install:
          if package_name.startswith('nvidia-driver-'):
             try:
                 version = int(package_name.split('-')[-1]) # <--- This here
                 with_nvidia_kms = version >= 470
             except ValueError:
                 pass
             finally:
                 with_nvidia_kms = version >= 470  # <-- And this here, too, 
which will never succeed.

  ```

  The line `version = int(package_name.split('-')[-1])` assumes a
  package name like `nvidia-driver-530` rather than `nvidia-
  driver-530-open`, however `nvidia-driver-530-open` is the autoselected
  package for my install.

  This code could be fixed by switching to a regex, or else retrying
  with index -2 rather than index -1.

  Also, the `finally` clause will always fail-- there should only ever
  be one matching `nvidia-driver-` prefixed package, and if that raises
  a ValueError, then `version` will not be set, raising an
  UnboundLocalError.

  ProblemType: Bug
  DistroRelease: Ubuntu 22.04
  Package: ubuntu-drivers-common 1:0.9.6.1 [modified: 
usr/lib/python3/dist-packages/UbuntuDrivers/detect.py]
  ProcVersionSignature: Ubuntu 5.19.0-41.42~22.04.1-generic 5.19.17
  Uname: Linux 5.19.0-41-generic x86_64
  ApportVersion: 2.20.11-0ubuntu82.4
  Architecture: amd64
  CasperMD5CheckResult: pass
  CurrentDesktop: ubuntu:GNOME
  Date: Tue May  9 10:47:07 2023
  InstallationDate: Installed on 2022-08-20 (261 days ago)
  InstallationMedia: Ubuntu 22.04.1 LTS "Jammy Jellyfish" - Release amd64 
(20220809.1)
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=en_US.UTF-8
   SHELL=/bin/zsh
  SourcePackage: ubuntu-drivers-common
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-drivers-common/+bug/2019016/+subscriptions


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

Reply via email to