Merge lp:~mvo/software-center/hopefully-fix-lp1008229 into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 3067
Proposed branch: lp:~mvo/software-center/hopefully-fix-lp1008229
Merge into: lp:software-center
Diff against target: 20 lines (+2/-1)
1 file modified
softwarecenter/db/debfile.py (+2/-1)
To merge this branch: bzr merge lp:~mvo/software-center/hopefully-fix-lp1008229
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+113060@code.launchpad.net

Description of the change

Trivial branch to merge some vars to ensure that they are defined, even if the file is not there.
From reviewing the code it seems like its the only way to trigger the bug in #1008229.
A possible test for this would be:
=== modified file 'tests/test_debfileapplication.py'
--- tests/test_debfileapplication.py 2012-05-30 18:39:55 +0000
+++ tests/test_debfileapplication.py 2012-07-02 14:53:20 +0000
@@ -32,6 +32,12 @@
     def setUp(self):
         self.db = get_test_db()

+ def test_regression_lp1008229(self):
+ debfileapplication = DebFileApplication(DEBFILE_PATH)
+ debfileapplication.request += "xxx"
+ debfiledetails = debfileapplication.get_details(self.db)
+ self.assertEqual(debfiledetails.version, None)
+
     def test_get_name(self):
         debfileapplication = DebFileApplication(DEBFILE_PATH)
         debfiledetails = debfileapplication.get_details(self.db)

but its really a hack as I couldn't find a better way to trigger it.

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

We should cherry pick this to 5.2 too

Revision history for this message
Gary Lasker (gary-lasker) wrote :

Yep, looking at the code it seems that this would only happen on an error opening the deb file, so this fix should take care of it. I wonder why so many people are hitting this though. Anyway, defining the variable early seems the right thing to do. Thanks mvo!

review: Approve
Revision history for this message
Gary Lasker (gary-lasker) wrote :

I merged this to trunk and to the 5.2 branch as well.

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

On Wed, Jul 11, 2012 at 01:19:19AM -0000, Gary Lasker wrote:
> Review: Approve

Thanks for the review.

> Yep, looking at the code it seems that this would only happen on an
> error opening the deb file, so this fix should take care of it. I
> wonder why so many people are hitting this though.
[..]

Yes, its a bit puzzling as I did not find a way to reproduce it yet.

Cheers,
 MIchael

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

On Wed, Jul 11, 2012 at 01:19:19AM -0000, Gary Lasker wrote:
> Review: Approve
>
> Yep, looking at the code it seems that this would only happen on an error opening the deb file, so this fix should take care of it. I wonder why so many people are hitting this though. Anyway, defining the variable early seems the right thing to do. Thanks mvo!

I just noticed that this got merged in trunk into the debian/changelog
for the already released 5.3.4 version changelog entry. As this
version is already released a new changelog entry for 5.3.5 needs to
get started in this case. Usually the best way to tell is if the
header contains UNRELEASED or not (or using rmadison software-center
to check, but that is usually not needed). I fixed this in trunk now.

Cheers,
 Michael

Revision history for this message
Gary Lasker (gary-lasker) wrote :

Oh, thank you for noticing that! Yes, I usually (every time before this) notice the UNRELEASED and if it's not there just do dch -i and add the UNRELEASED. I just missed it this time. Thanks again for finding it and taking care of it.

However, I did *not* know about rmadison. I usually use LP itself to get the versions, this is way easier! So thanks for that too!

Revision history for this message
Gary Lasker (gary-lasker) wrote :

Oh, and I also could not manage to figure out how to trigger this bug. I would love to know how people are hitting this. Hopefully, as per your branch title, this fix will take care of it. By inspection, it seems the correct fix and it has no downside. In any case, errors.ubuntu.com will (eventually) tell the tale. :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/db/debfile.py'
2--- softwarecenter/db/debfile.py 2012-05-16 15:52:07 +0000
3+++ softwarecenter/db/debfile.py 2012-07-02 14:56:19 +0000
4@@ -69,6 +69,8 @@
5 raise DebFileOpenError("AppDetailsDebFile: doc must be None.")
6
7 self._error = None
8+ self._deb = None
9+
10 # check errors before creating the DebPackage
11 if not os.path.exists(self._app.request):
12 self._error = _("Not found")
13@@ -88,7 +90,6 @@
14 # but that is no longer the case with the latest apt
15 self._deb = DebPackage(self._app.request, self._cache._cache)
16 except:
17- self._deb = None
18 # deb files which are corrupt
19 self._error = _("Internal Error")
20 self._error_not_found = utf8(_(u"The file \u201c%s\u201d "

Subscribers

People subscribed via source and target branches