Merge lp:~gary-lasker/software-center/for-3.0-osomon-fix-lp725186 into lp:software-center/3.0

Proposed by Gary Lasker
Status: Merged
Merged at revision: 1124
Proposed branch: lp:~gary-lasker/software-center/for-3.0-osomon-fix-lp725186
Merge into: lp:software-center/3.0
Diff against target: 73 lines (+31/-17)
2 files modified
debian/changelog (+8/-0)
softwarecenter/apt/apthistory.py (+23/-17)
To merge this branch: bzr merge lp:~gary-lasker/software-center/for-3.0-osomon-fix-lp725186
Reviewer Review Type Date Requested Status
software-store-developers Pending
Review via email: mp+51997@code.launchpad.net

Description of the change

This is a backport to maverick from Olivier Tilloy of his fix for bug 725186. We should consider this for an SRU. Please see the bug for details.

Thanks!

To post a comment you must log in.

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-02-10 08:25:06 +0000
3+++ debian/changelog 2011-03-03 02:13:01 +0000
4@@ -1,3 +1,11 @@
5+software-center (3.0.9) UNRELEASED; urgency=low
6+
7+ [ Olivier Tilloy ]
8+ * softwarecenter/apt/apthistory.py:
9+ - fix startup crash if the history file is corrupted (LP: #725186)
10+
11+ -- Gary Lasker <gary.lasker@canonical.com> Mon, 28 Feb 2011 16:20:50 -0500
12+
13 software-center (3.0.8) maverick-proposed; urgency=low
14
15 [ Gary Lasker ]
16
17=== modified file 'softwarecenter/apt/apthistory.py'
18--- softwarecenter/apt/apthistory.py 2010-09-16 09:50:32 +0000
19+++ softwarecenter/apt/apthistory.py 2011-03-03 02:13:01 +0000
20@@ -27,6 +27,7 @@
21 import logging
22 import string
23 import datetime
24+import zlib
25
26
27 from datetime import datetime
28@@ -107,23 +108,28 @@
29 except IOError, ioe:
30 LOG.debug(ioe)
31 return
32- for stanza in deb822.Deb822.iter_paragraphs(f):
33- # keep the UI alive
34- while self.main_context.pending():
35- self.main_context.iteration()
36- # ignore records with
37- try:
38- trans = Transaction(stanza)
39- except KeyError, e:
40- continue
41- # ignore the ones we have already
42- if (rescan and
43- len(self.transactions) > 0 and
44- trans.start_date < self.transactions[0].start_date):
45- break
46- # add it
47- self.transactions.insert(0, trans)
48-
49+ try:
50+ for stanza in deb822.Deb822.iter_paragraphs(f):
51+ # keep the UI alive
52+ while self.main_context.pending():
53+ self.main_context.iteration()
54+ # ignore records with
55+ try:
56+ trans = Transaction(stanza)
57+ except KeyError, e:
58+ continue
59+ # ignore the ones we have already
60+ if (rescan and
61+ len(self.transactions) > 0 and
62+ trans.start_date < self.transactions[0].start_date):
63+ break
64+ # add it
65+ self.transactions.insert(0, trans)
66+ except zlib.error, ze:
67+ # corrupted history file, skip it
68+ # (see http://bugs.launchpad.net/bugs/725186)
69+ LOG.debug(ze)
70+
71 def _on_apt_history_changed(self, monitor, afile, other_file, event):
72 if event == gio.FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
73 self._scan(self.history_file, rescan = True)

Subscribers

People subscribed via source and target branches