← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 1575960] Re: gpu-manager: get_alternative_link() NEVER checks for a correct alternative

 

This bug was fixed in the package ubuntu-drivers-common - 1:0.4.18

---------------
ubuntu-drivers-common (1:0.4.18) yakkety; urgency=medium

  * gpu-manager.c:
    - Pass the arguments in the correct order when getting
      the list of alternatives (LP: #1575960).
      Thanks to Rafał Cieślak for the fix.

 -- Alberto Milone <alberto.milone@xxxxxxxxxxxxx>  Fri, 29 Apr 2016
12:29:03 +0200

** Changed in: ubuntu-drivers-common (Ubuntu)
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1575960

Title:
  gpu-manager: get_alternative_link() NEVER checks for a correct
  alternative

Status in ubuntu-drivers-common package in Ubuntu:
  Fix Released
Status in ubuntu-drivers-common source package in Xenial:
  Fix Released

Bug description:
  SRU Request:

  [Impact]
  The current code will prevent gpu-manager from getting the correct list of alternatives. This breaks the detection system.

  [Test Case]
  Install the nvidia driver and check that gpu-manager reconfigures the system properly. More specifically, there should be no "Error: no alternative found for nvidia" line in /var/log/gpu-manager.log if the driver was installed correctly.

  [Regression Potential]
  Low, it is a one line change and a pretty obvious fix.

  __________________________________________________________________________

  I suppose this is a fairly significant bug, since it renders gpu-manager virtually useless.
  I found it in ubuntu-drivers-common 0.4.17 (which is the current version in Ubuntu 16.04), and I do not know whether it is also present in other versions.

  -- Symptoms --

  For some reason, on my machine I frequently insert and remove my
  nvidia graphics adapter. My processor has an intel HD graphics adapter
  as well, so I rely on gpu-manager to detect my hardware configuration
  during boot, and update alternatives appropriately.

  However, since I upgraded to Ubuntu 16.04, reconfiguring my hardware
  makes me unable to boot to desktop. However, reverting to previous
  hardware configuration solves the issue.

  -- Analysis and proposed solution --

  A quick check of symbolic links at /etc/ld.so.conf.d/x86_64-linux-
  gnu_GL.conf and similar confirms that when I change my hardware
  configuration, no changes are done to the targets of these links.
  Reading through gpu-manager.log I can see that it detects my hardware
  correctly, but it fails to configure alternatives, because:

      Error: no alternative found for nvidia
      Warning: no EGL alternative found for nvidia

  Further investigation shows that the problem is with the
  get_alternative_link() function, as it always returns NULL, regardless
  of my current hardware configuration, and function arguments.

  The get_alternative_link() function works by querying the list of
  available alternatives by running `update-alternatives` command with
  `--list` argument. The command is prepared by:

          snprintf(command, sizeof(command),
                   "update-alternatives --list %s_%s_conf",
                   alternative_pattern, arch_path);

  For example, when looking for "gl" alternatives for architecture
  "x86_64-linux-gnu", the resulting command will be:

      update-alternatives --list gl_x86_64-linux-gnu_conf

  This command always returns an empty list, and that is correct. The
  command is clearly malformed, the intention was to run another
  command, namely:

      update-alternatives --list x86_64-linux-gnu_gl_conf

  (note the order of "gl" vs "x86_64_linux_gnu")
  Indeed the `snprintf` used to prepare the command has it's arguments swapped. Therefore I propose to substitute the mentioned source code with:

          snprintf(command, sizeof(command),
                   "update-alternatives --list %s_%s_conf",
                   arch_path, alternative_pattern);

  Applying the proposed change reliably fixes the bug symptoms I
  experienced.

  -- Additional comment --

  For your convenience, I attached to this bug report a patch file that applies the proposed solution; the patch is intended for ubuntu-drivers-common 0.4.17 source.
  As far as I can tell, due to these swapped arguments gpu-manager always looks for unexisting alternatives, and therefore there is no scenario in which it would correctly configure alternatives. I suppose in this case gpu-manager always fails to serve its purpose. I find it astonishing that nobody noticed this issue yet.

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