Merge lp:~gary-lasker/software-center/fix-crash-lp870822 into lp:software-center

Proposed by Gary Lasker
Status: Merged
Merge reported by: Gary Lasker
Merged at revision: not available
Proposed branch: lp:~gary-lasker/software-center/fix-crash-lp870822
Merge into: lp:software-center
Diff against target: 22 lines (+8/-4)
1 file modified
softwarecenter/ui/gtk3/views/appdetailsview.py (+8/-4)
To merge this branch: bzr merge lp:~gary-lasker/software-center/fix-crash-lp870822
Reviewer Review Type Date Requested Status
Michael Vogt Approve
Review via email: mp+104291@code.launchpad.net

Description of the change

This branch fixes a crash that a few people have gotten when viewing the appdetails pane, see bug 870822. The crash occurs during the calculation of the total size for the package. Under certain conditions, the installed size value is obtained from the cache itself by getting an AptCacheVersion object for the package. The crash occurs when a None is returned for the AptCacheVersion object.

In this case, with this fix we simply display the default "Unknown" value for size, as we have not been able to successfully determine it.

Unfortunately, I have been unable to reproduce this issue myself and so can't provide steps to do so, but we have gotten reports of it as late as software-center 5.2 final, so there are conditions under which it can occur and these conditions exist in our most recent versions.

This is a low-risk fix as we simply detect the None and display "Unknown" for that case.

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

Thanks for the branch. The fix is fine.

What puzzles me is that it can happen that we get None here when the applicaton says
its in the state "INSTALLED".

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'softwarecenter/ui/gtk3/views/appdetailsview.py'
--- softwarecenter/ui/gtk3/views/appdetailsview.py 2012-04-18 10:31:00 +0000
+++ softwarecenter/ui/gtk3/views/appdetailsview.py 2012-05-01 20:26:18 +0000
@@ -2024,10 +2024,14 @@
2024 self.app_details.pkg_state == PkgStates.INSTALLED and2024 self.app_details.pkg_state == PkgStates.INSTALLED and
2025 not self.addons_manager.addons_to_install and2025 not self.addons_manager.addons_to_install and
2026 not self.addons_manager.addons_to_remove):2026 not self.addons_manager.addons_to_remove):
2027 pkg = self.cache[self.app_details.pkgname].installed2027 pkg_version = self.cache[self.app_details.pkgname].installed
2028 install_size = GLib.format_size(pkg.installed_size)2028 # we may not always get a pkg_version returned (LP: #870822),
2029 # FIXME: this is not really a good indication of the size on disk2029 # in that case, we'll just have to display "Unknown"
2030 label_string += _("%s on disk") % (install_size)2030 if pkg_version:
2031 install_size = GLib.format_size(pkg_version.installed_size)
2032 # FIXME: this is not really a good indication of the size
2033 # on disk
2034 label_string += _("%s on disk") % (install_size)
2031 elif total_install_size < 0:2035 elif total_install_size < 0:
2032 remove_size = GLib.format_size(-total_install_size)2036 remove_size = GLib.format_size(-total_install_size)
2033 label_string += _("%s to be freed") % (remove_size)2037 label_string += _("%s to be freed") % (remove_size)

Subscribers

People subscribed via source and target branches