Merge lp:~seb128/software-properties/handle-no-candidate into lp:software-properties

Proposed by Sebastien Bacher
Status: Merged
Merged at revision: 890
Proposed branch: lp:~seb128/software-properties/handle-no-candidate
Merge into: lp:software-properties
Diff against target: 15 lines (+4/-1)
1 file modified
softwareproperties/gtk/SoftwarePropertiesGtk.py (+4/-1)
To merge this branch: bzr merge lp:~seb128/software-properties/handle-no-candidate
Reviewer Review Type Date Requested Status
Michael Vogt (community) Approve
Didier Roche-Tolomelli Pending
Ubuntu Core Development Team Pending
Review via email: mp+197917@code.launchpad.net

Commit message

When a package has no candidate version just display its name

Description of the change

When a package has no candidate version just display its name

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Not sure what it means having no candidate version, but that's happening, see that error bucket
https://errors.ubuntu.com/problem/55c1babf9ec1556365267f9ae7de740aec64d777

" File "/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py", line 1260, in gather_device_data
    description = _("Using {} from {}").format(pkg.candidate.summary, pkg.shortname)
AttributeError: 'NoneType' object has no attribute 'summary'"

(I tried to install an nvidia driver and remove the apt source containing it but that's not enough to reproduce the issue)

Note that you can test software-propoerties on hardware that don't require binary drivers using
"usr/share/ubuntu-drivers-common/fake-devices-wrapper software-properties-gtk"

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for this branch, +1 for the approach. But it would be nice to know why there is no candidate. If there is no candidate it usually means it can't be downloaded and its not installed. So we could consider skipping displaying it.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the review Michael, I think it goes the other way around there
- install a driver
- upgrade to a new serie
- the driver in ubuntu get dropped/replaced for some reason (think nvidia driver changing number)
- you end up with a locally installed driver that is deprecated/not in the repository

The UI needs to list that driver since it's installed

Not sure what makes the candidate be there or not though, I tried that theory by installing a driver and then disabling "restricted" (and refreshing the apt index) ... apt was only listing the local version (e.g /var/lib/dpkg/info source) but it still had a candidate version, not sure what needs to happen for a locally installed package to not have a candidate?

Revision history for this message
Sebastien Bacher (seb128) wrote :

Michael, is there any way an installed package could have no candidate? (what does "candidate" means/where is it coming from?)

Revision history for this message
Brian Murray (brian-murray) wrote :

One interesting thing to note about the problem instances of the linked error report is that some (at least the first four) have an origin of unknown for software-properties-gtk. I believe this can happen when you install without internet connectivity so there is no information in the apt package cache. However, I tried a fresh install and then manually installed umockdev (and its related packages) to be able to run fake-drivers-wrapper and was unable to recreate the crash.

Its also worth noting that some of the instances are also tagged third-party-packages.

Revision history for this message
Michael Vogt (mvo) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwareproperties/gtk/SoftwarePropertiesGtk.py'
2--- softwareproperties/gtk/SoftwarePropertiesGtk.py 2013-10-21 15:13:30 +0000
3+++ softwareproperties/gtk/SoftwarePropertiesGtk.py 2013-12-05 16:23:34 +0000
4@@ -1259,7 +1259,10 @@
5 try:
6 pkg = self.apt_cache[pkg_driver_name]
7 installed = pkg.is_installed
8- description = _("Using {} from {}").format(pkg.candidate.summary, pkg.shortname)
9+ if pkg.candidate is not None:
10+ description = _("Using {} from {}").format(pkg.candidate.summary, pkg.shortname)
11+ else:
12+ description = _("Using {}").format(pkg.shortname)
13 except KeyError:
14 print("WARNING: a driver ({}) doesn't have any available package associated: {}".format(pkg_driver_name, current_driver))
15 continue

Subscribers

People subscribed via source and target branches

to status/vote changes: