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
=== modified file 'debian/changelog'
--- debian/changelog 2011-09-30 20:13:46 +0000
+++ debian/changelog 2011-10-06 20:33:27 +0000
@@ -1,8 +1,9 @@
1checkbox (0.13) oneiric; urgency=low1checkbox (0.13) oneiric; urgency=low
22
3 * Incremented version 3 [Daniel Manrique]
4 * Ignore malformed dpkg entries in package_resource (LP: #794747)
45
5 -- Daniel Manrique <daniel.manrique@canonical.com> Fri, 30 Sep 2011 16:12:08 -04006 -- Daniel Manrique <daniel.manrique@canonical.com> Fri, 30 Sep 2011 16:14:40 -0400
67
7checkbox (0.12.8) oneiric; urgency=low8checkbox (0.12.8) oneiric; urgency=low
89
910
=== modified file 'scripts/package_resource'
--- scripts/package_resource 2010-03-28 14:48:55 +0000
+++ scripts/package_resource 2011-10-06 20:33:27 +0000
@@ -51,6 +51,8 @@
51 "x": "both-problems"}51 "x": "both-problems"}
5252
53 columns = ["desired", "status", "error", "name", "version", "description"]53 columns = ["desired", "status", "error", "name", "version", "description"]
54 mandatory_columns = columns[:]
55 mandatory_columns.remove("error") #this is optional
54 aliases = {56 aliases = {
55 "linux-image-" + os.uname()[2]: "linux"}57 "linux-image-" + os.uname()[2]: "linux"}
5658
@@ -84,6 +86,10 @@
84 if value:86 if value:
85 package[column] = value87 package[column] = value
8688
89 #Skip records not containing all mandatory columns
90 if not set(mandatory_columns).issubset(package.keys()):
91 continue
92
87 name = package["name"]93 name = package["name"]
88 if name in aliases:94 if name in aliases:
89 yield dict(package)95 yield dict(package)

Subscribers

People subscribed via source and target branches