Merge lp:~aaronp/software-center/fix-694836 into lp:software-center

Proposed by Aaron Peachey
Status: Merged
Merged at revision: 1456
Proposed branch: lp:~aaronp/software-center/fix-694836
Merge into: lp:software-center
Diff against target: 15 lines (+5/-1)
1 file modified
softwarecenter/view/catview_gtk.py (+5/-1)
To merge this branch: bzr merge lp:~aaronp/software-center/fix-694836
Reviewer Review Type Date Requested Status
Michael Vogt Pending
Review via email: mp+48451@code.launchpad.net

Commit message

avoid div by 0 to temporarily fix bug lp:694836

Description of the change

avoid div by 0 to temporarily fix bug lp:694836

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

Heya Aaron! Thanks for working on this one and for your branch! I took a quick look at this error myself yesterday and it's not quite clear to me yet why the value of self.n_posters is zero, as by all rights it really should never be. We do have some asynchronous activity at startup and that may be the contributing factor, tho without looking closer that's just an assumption. I wondered if you had any thoughts or insights about it?

So one thing that I note is that this problem was first reported at version 3.1.9, so it's possible that a change there has allowed this condition to occur (of course, it also may just not have been encountered/reported before then).

It may very well be that your fix is all that's required. My only concern is for the off-chance that there may be other glitches or side effects caused by the underlying bug that may be unmasked now that we have taken care of the divide-by-zero condition. Specifically, I'm wondering whether all the associated UI elements still render/work correctly, etc.? I noticed in one of the dupes (bug 712121), Jean-Baptiste (jibel) reports that all the categories are empty (though that have just been due to the ZeroDivisionError itself).

It might be useful to find a way to induce the bug artificially, or even better, to write a test case for the bug (though I suspect that won't be terribly straightforward to do).

Anyway, please let me know what you think. And thanks again for all your good work!! It's so great to have you aboard the Software Center team.

Cheers,
Gary

P.S. Our time zones are way out (I'm in Massachusetts USA), but if you happen to catch me on IRC please say hello. :) I'm "tremolux" there and I hang out in #ubuntu-desktop and #ubuntu-devel, among many others. See ya then!

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

P.P.S. Gotta love trying to fix bugs that you yourself can't reproduce, eh?? :D

Revision history for this message
Aaron Peachey (aaronp) wrote :

Hi Gary, thanks.

It's a good challenge but limits you to just treating the symptoms and not
the cause. I couldn't figure out how self.n_posters would ever be 0 either
so I'm hoping that this fix will let the method complete and then the users
might see some unexpected behaviour in the carousels which will point us to
the real problem. I dont really have any other thoughts except that we set
it to 0 in init which makes me think some methods that run later to set it
to something non-0 are not always working (or getting called).

Will say hi next time I see you on irc.

Cheers
Aaron
On 04/02/2011 5:38 AM, "Gary Lasker" <email address hidden> wrote:
> P.P.S. Gotta love trying to fix bugs that you yourself can't reproduce,
eh?? :D
> --
> https://code.launchpad.net/~aaronp/software-center/fix-694836/+merge/48451
> You are the owner of lp:~aaronp/software-center/fix-694836.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/view/catview_gtk.py'
2--- softwarecenter/view/catview_gtk.py 2011-01-28 08:34:12 +0000
3+++ softwarecenter/view/catview_gtk.py 2011-02-03 11:34:53 +0000
4@@ -777,7 +777,11 @@
5 if self._offset >= len(self.carousel_apps):
6 self._offset = 0
7 # print 'BW:', width, self.page_sel.allocation.width
8- page = self._offset / self.n_posters
9+ #temporary fix for crash in bug 694836
10+ if self.n_posters == 0:
11+ page = self._offset / 1
12+ else:
13+ page = self._offset / self.n_posters
14 self.page_sel.set_selected_page(int(page))
15 return
16

Subscribers

People subscribed via source and target branches