update-software-center crashed with order (MRO) for bases SafeConfigParser, object in __new__()

Bug #1038429 reported by kossmac
182
This bug affects 48 people
Affects Status Importance Assigned to Milestone
Ubuntu Software Center
Status tracked in Trunk
Stable-13-10
Fix Released
High
dobey
Trunk
Fix Released
Critical
dobey
software-center (Ubuntu)
Fix Released
Critical
dobey
Saucy
Fix Released
Critical
dobey

Bug Description

I don't know why it occurs but just after system start or after waking up the error shows up.

ProblemType: Crash
DistroRelease: Ubuntu 12.10
Package: software-center 5.3.7
ProcVersionSignature: Ubuntu 3.5.0-10.10-generic 3.5.1
Uname: Linux 3.5.0-10-generic x86_64
ApportVersion: 2.4-0ubuntu8
Architecture: amd64
Date: Sat Aug 18 12:18:46 2012
ExecutablePath: /usr/share/software-center/update-software-center
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Alpha amd64 (20120627)
InterpreterPath: /usr/bin/python2.7
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/sbin/update-software-center --triggered 5.3.6
PythonArgs: ['/usr/sbin/update-software-center', '--triggered', '5.3.6']
SourcePackage: software-center
Title: update-software-center crashed with order (MRO) for bases SafeConfigParser, object in __new__()
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups:

Related branches

Revision history for this message
kossmac (kosmala) wrote :
tags: removed: need-duplicate-check
Changed in software-center (Ubuntu):
importance: Undecided → Medium
visibility: private → public
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in software-center (Ubuntu):
status: New → Confirmed
Revision history for this message
Peter Johnson (pajohnson) wrote :

I had the same problem after updating to 12.10, with software-center always crashing immediately. I fixed it by changing line 33 of /usr/share/software-center/softwarecenter/config.py from
class SoftwareCenterConfig(object, SafeConfigParser):
to
class SoftwareCenterConfig(SafeConfigParser):

Revision history for this message
Simon Davy (bloodearnest) wrote :

Peter's fix works for me, until it's updated anyway

Revision history for this message
Jose C. Massón (jose-masson) wrote :
Download full text (3.6 KiB)

With Peter's fix I have the following:

➜ ~ software-center
2013-03-06 13:18:22,757 - softwarecenter.ui.gtk3.app - INFO - setting up proxy 'None'
2013-03-06 13:18:22,763 - softwarecenter.db.database - INFO - open() database: path=None use_axi=True use_agent=True
2013-03-06 13:18:23,208 - softwarecenter.backend.reviews - WARNING - Could not get usefulness from server, no username in config file
2013-03-06 13:18:23,316 - softwarecenter.ui.gtk3.app - INFO - show_available_packages: search_text is '', app is None.
2013-03-06 13:18:23,328 - softwarecenter.db.pkginfo_impl.aptcache - INFO - aptcache.open()
2013-03-06 13:18:24,134 - softwarecenter.db.categories - WARNING - '/usr/share/desktop-directories/Utility.directory' has no name
2013-03-06 13:18:24,135 - softwarecenter.db.categories - WARNING - '/usr/share/desktop-directories/Utility-Accessibility.directory' has no name
2013-03-06 13:18:24,141 - softwarecenter.db.categories - WARNING - '/usr/share/desktop-directories/Education.directory' has no name
Traceback (most recent call last):
  File "/usr/bin/software-center", line 182, in <module>
    app.run(args)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 1387, in run
    self.show_available_packages(args)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 1325, in show_available_packages
    self.view_manager.set_active_view(ViewPages.AVAILABLE)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/session/viewmanager.py", line 151, in set_active_view
    view_widget.init_view()
  File "/usr/share/software-center/softwarecenter/ui/gtk3/panes/availablepane.py", line 139, in init_view
    SoftwarePane.init_view(self)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/panes/softwarepane.py", line 138, in init_view
    self.icons, self.show_ratings)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/views/appview.py", line 70, in __init__
    self.helper = AppPropertiesHelper(db, cache, icons)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/models/appstore2.py", line 108, in __init__
    self.all_categories = cat_parser.parse_applications_menu()
  File "/usr/share/software-center/softwarecenter/db/categories.py", line 277, in parse_applications_menu
    category = self._parse_menu_tag(child)
  File "/usr/share/software-center/softwarecenter/db/categories.py", line 471, in _parse_menu_tag
    query = self._parse_include_tag(element)
  File "/usr/share/software-center/softwarecenter/db/categories.py", line 429, in _parse_include_tag
    xapian.Query.OP_AND)
  File "/usr/share/software-center/softwarecenter/db/categories.py", line 366, in _parse_and_or_not_tag
    operator_elem, xapian.Query(), xapian.Query.OP_OR)
  File "/usr/share/software-center/softwarecenter/db/categories.py", line 412, in _parse_and_or_not_tag
    q = self.db.xapian_parser.parse_query(s,
  File "/usr/share/software-center/softwarecenter/db/database.py", line 185, in xapian_parser
    xapian_parser = self._get_new_xapian_parser()
  File "/usr/share/software-center/softwarecenter/db/database.py", line 211, in _get_new_xapian_parser
    xapian_parser.set_database(self.xapiandb)
  File "/usr/share/software-ce...

Read more...

Revision history for this message
Ken (kkinder) wrote :

The problem is this.

At the beginning of /usr/share/software-center/softwarecenter/config.py, it imports either configparser or ConfigParser based on what will import, apparently based on the incorrect belief that "configparser" is for Python3 while "ConfigParser" is Python2.7:

try:
    from configparser import SafeConfigParser
    SafeConfigParser # pyflakes
except ImportError:
    from ConfigParser import SafeConfigParser

So the background is that Python2.x has "ConfigParser" and Python3 has "configparser". Yes, that's kind of weird. In Python3, they decided to standardize on lower-case package names, so ConfigParser became configparser.

The problem is, Software Center's developers didn't realize that the classes also changed somewhat. Example:

Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import configparser, ConfigParser
>>> issubclass(configparser.SafeConfigParser, object)
True
>>> issubclass(ConfigParser.SafeConfigParser, object)
False

Software Center is crashing because ConfigParser and configparser are not identical and apparently, it was just assumed that they were. What I'm not sure is why this only affects a handful of people. Perhaps our ppa's have forced an upgrade in Python that Software Center wasn't tested against. At any rate, here's a patch.

Revision history for this message
Ken (kkinder) wrote :

Actually, I should clarify:

> incorrect belief that "configparser" is for Python3 while "ConfigParser" is Python2.7

That belief is correct. The assumption that's not correct is that they are otherwise identical. They are not.

Revision history for this message
Ken (kkinder) wrote :

Also, I don't see my patch that I attached. Weird. Here it is, in plaintext:

--- /usr/share/software-center/softwarecenter/config.py.orig 2013-04-03 00:04:17.852950494 -0600
+++ /usr/share/software-center/softwarecenter/config.py 2013-04-03 00:16:34.680963943 -0600
@@ -29,8 +29,15 @@

 LOG = logging.getLogger(__name__)

+# See https://bugs.launchpad.net/ubuntu/+source/software-center/+bug/1038429
+if issubclass(SafeConfigParser, object):
+ class BaseSoftwareCenterConfig(SafeConfigParser):
+ pass
+else:
+ class BaseSoftwareCenterConfig(SafeConfigParser, object):
+ pass

-class SoftwareCenterConfig(object, SafeConfigParser):
+class SoftwareCenterConfig(BaseSoftwareCenterConfig):

     SECTIONS = ("general", "reviews")

Revision history for this message
Ken (kkinder) wrote :

Hmmm. Didn't paste right with indentation. Sorry about this, I don't know why it won't show my attachment. Here's a pastebin:

http://pastebin.com/bnmmRqff

Revision history for this message
anville (anville) wrote :

Just to chime in with my take on this problem:

Running on Ubuntu 13.04, I have an Python 2.7-based app that relies on the back-ported (from 3.x) "configparser" module (https://pypi.python.org/pypi/configparser)

After I do a "sudo pip install configparser", I get the behavior noticed above when software-center runs.

If I uninstall configparser via pip, the problem goes away.

Using Peter Johnson's fix/hack in #3, I have a temporary fix for this.

Revision history for this message
Jeroen Ruigrok van der Werven (asmodai) wrote :

To chime in, the fix in #3 also temporarily allows me to get by.

Revision history for this message
Colin Watson (cjwatson) wrote :

This is now blocking image builds, because the python-configparser package is newly pulled into those by python-configglue.

Changed in software-center (Ubuntu):
importance: Medium → Critical
Revision history for this message
Iain Lane (laney) wrote :

Hey Rodney,

We noticed that this error is happening on dist-upgrades in current Saucy, and also for CD image builds - making both fail.

python-configglue as of the latest upgrade is pulling in python-configparser (this is a dep of ubuntunone-client) which exposes the bug in software-center.

There's some analysis here - could you see if you agree with any of it or have a solution of your own to propose? From my side I wonder if inheriting object there is necessary but I don't know the code.

If you need some sponsorship then please ping me; this is one that's good to fix quite quickly.

Thanks.

Changed in software-center (Ubuntu):
assignee: nobody → Rodney Dawes (dobey)
importance: Critical → Medium
Changed in software-center (Ubuntu Saucy):
importance: Medium → Critical
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package software-center - 13.05-0ubuntu2

---------------
software-center (13.05-0ubuntu2) saucy; urgency=low

  * debian/patches/01_bzr-fix-1038429.patch:
    - Don't use MI, and use super to call the parent __init__. (LP: #1038429)
 -- Rodney Dawes <email address hidden> Fri, 05 Jul 2013 17:39:12 -0400

Changed in software-center (Ubuntu Saucy):
status: Confirmed → Fix Released
Revision history for this message
SalmanABbas007 (salmanabbas007) wrote :

Geez da hell is a normal user supposed to do? Not install any software for a few months (until this is released)? Shit like this is why we still aren't anywhere close to the "Year of Linux Desktop".

Revision history for this message
Barry Warsaw (barry) wrote :
Revision history for this message
Admiuistrator (admiuistrator) wrote :

While this lists out as the fixed has been released, I did an update today and the issue still exists with the Ububtu Software Center failing to open. Can you maybe give us a command line to try so that we can manually install the fix?

Dave Morley (davmor2)
tags: added: u1-notrack
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.