Merge lp:~roadmr/checkbox/794747 into lp:checkbox

Proposed by Daniel Manrique
Status: Merged
Merged at revision: 1117
Proposed branch: lp:~roadmr/checkbox/794747
Merge into: lp:checkbox
Diff against target: 39 lines (+9/-2)
2 files modified
debian/changelog (+3/-2)
scripts/package_resource (+6/-0)
To merge this branch: bzr merge lp:~roadmr/checkbox/794747
Reviewer Review Type Date Requested Status
Brendan Donegan (community) Approve
Review via email: mp+78498@code.launchpad.net

Description of the change

The linked bug report describes an unlikely corner case where a borked package description causes malformed output from dpkg-query which in turn crashes package_resource. This fix ensures that after parsing each record, all required fields are present; failing this, it silently ignores the record.

To post a comment you must log in.
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

Had to clean up the changelog a little bit, but otherwise looks pretty good. Merging.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-09-30 20:13:46 +0000
3+++ debian/changelog 2011-10-06 20:33:27 +0000
4@@ -1,8 +1,9 @@
5 checkbox (0.13) oneiric; urgency=low
6
7- * Incremented version
8+ [Daniel Manrique]
9+ * Ignore malformed dpkg entries in package_resource (LP: #794747)
10
11- -- Daniel Manrique <daniel.manrique@canonical.com> Fri, 30 Sep 2011 16:12:08 -0400
12+ -- Daniel Manrique <daniel.manrique@canonical.com> Fri, 30 Sep 2011 16:14:40 -0400
13
14 checkbox (0.12.8) oneiric; urgency=low
15
16
17=== modified file 'scripts/package_resource'
18--- scripts/package_resource 2010-03-28 14:48:55 +0000
19+++ scripts/package_resource 2011-10-06 20:33:27 +0000
20@@ -51,6 +51,8 @@
21 "x": "both-problems"}
22
23 columns = ["desired", "status", "error", "name", "version", "description"]
24+ mandatory_columns = columns[:]
25+ mandatory_columns.remove("error") #this is optional
26 aliases = {
27 "linux-image-" + os.uname()[2]: "linux"}
28
29@@ -84,6 +86,10 @@
30 if value:
31 package[column] = value
32
33+ #Skip records not containing all mandatory columns
34+ if not set(mandatory_columns).issubset(package.keys()):
35+ continue
36+
37 name = package["name"]
38 if name in aliases:
39 yield dict(package)

Subscribers

People subscribed via source and target branches