Stack trace when package has no candidate in debug mode
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
unattended-upgrades (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
This is what I get when running unattended-upgrades --debug:
Initial blacklisted packages:
Starting unattended upgrades script
...
Traceback (most recent call last):
File "/usr/bin/
main()
File "/usr/bin/
logging.
pkg.candidate.
AttributeError: 'NoneType' object has no attribute 'origins'
The problem is that the unattended-upgrades script doesn't check the value of pkg.candidate before calling the origins attribute on it. As can be seen in the apt.package.Package class, the candidate attribute might be None:
def candidate(self):
"""Return the candidate version of the package.
This property is writeable to allow you to set the candidate version
of the package. Just assign a Version() object, and it will be set as
the candidate version.
"""
cand = self._pcache.
if cand is not None:
return Version(self, cand)
Therefore, the unattended-upgrades script should expect this eventually. This can easily be done by using getattr and returning an empty list there are no candidates.
Related branches
- Brian Murray: Needs Fixing
- Ubuntu branches: Pending requested
-
Diff: 32 lines (+5/-1)2 files modifieddebian/changelog (+4/-0)
unattended-upgrade (+1/-1)
Changed in unattended-upgrades (Ubuntu): | |
importance: | Undecided → Medium |
Status changed to 'Confirmed' because the bug affects multiple users.