Software-Center crash at launch if apt-history gzip archives are corrupted

Bug #725186 reported by Jean-Alexandre Anglès d'Auriac on 2011-02-25
This bug affects 1 person
Affects Status Importance Assigned to Milestone
software-center (Ubuntu)
Olivier Tilloy
Gary Lasker

Bug Description

Binary package hint: software-center

If the apt history gzip archives contained in /var/log/apt/ are corrupted, then Software-Center crash at launch.
I attached the corrupted archive that triggered the bug on my laptop.

TEST CASE (for Maverick SRU):

1. Run Maverick.
2. In a terminal, type the following commands to temporarily swap in a corrupted apt history file (the original will be restored after):

  sudo mv /var/log/apt/history.log.1.gz /var/log/apt/history.log.1.gz.SAVE
  sudo cp history.log.5.gz /var/log/apt/history.log.1.gz

3. Launch Software Center by typing the following into a terminal (this will allow you to verify the error output):


4. Verify that software-center crashes (does not start) and the error output in the terminal ends with:

  "zlib.error: Error -3 while decompressing: invalid distance too far back"

5. Install the updated version of Software Center (3.0.9) from maverick-proposed.
6. Launch Software Center again from the terminal (or directly) and verify that Software Center now launches correctly (the main window is displayed, etc.).
7. Type the following in a terminal to restore your previous apt history log:

  sudo mv /var/log/apt/history.log.1.gz.SAVE /var/log/apt/history.log.1.gz

Related branches

Olivier Tilloy (osomon) wrote :

Thanks for the report. I can confirm the issue with S-C 3.0.7 in maverick.
The issue was fixed in the trunk at revision 1284, available in S-C ≥ 3.1.1.
We may want to backport the fix to Maverick though, as it is a crasher that renders S-C unusable.

Changed in software-center (Ubuntu):
status: New → Fix Released
Olivier Tilloy (osomon) wrote :

Here is the traceback generated on Maverick:

Traceback (most recent call last):
  File "/usr/bin/software-center", line 90, in <module>
    app = SoftwareCenterApp(datadir, xapian_base_path, options, args)
  File "/usr/share/software-center/softwarecenter/", line 149, in __init__
    self.history = get_apt_history()
  File "/usr/share/software-center/softwarecenter/apt/", line 178, in get_apt_history
    apt_history = AptHistory()
  File "/usr/share/software-center/softwarecenter/apt/", line 83, in __init__
  File "/usr/share/software-center/softwarecenter/apt/", line 98, in rescan
  File "/usr/share/software-center/softwarecenter/apt/", line 110, in _scan
    for stanza in deb822.Deb822.iter_paragraphs(f):
  File "/usr/lib/pymodules/python2.6/debian/", line 287, in iter_paragraphs
    x = cls(iterable, fields, encoding=encoding)
  File "/usr/lib/pymodules/python2.6/debian/", line 255, in __init__
    self._internal_parser(sequence, fields)
  File "/usr/lib/pymodules/python2.6/debian/", line 308, in _internal_parser
    for line in self.gpg_stripped_paragraph(sequence):
  File "/usr/lib/pymodules/python2.6/debian/", line 551, in gpg_stripped_paragraph
    return cls.split_gpg_and_payload(sequence)[1]
  File "/usr/lib/pymodules/python2.6/debian/", line 503, in split_gpg_and_payload
    for line in sequence:
  File "/usr/lib/python2.6/", line 438, in next
    line = self.readline()
  File "/usr/lib/python2.6/", line 393, in readline
    c =
  File "/usr/lib/python2.6/", line 219, in read
  File "/usr/lib/python2.6/", line 271, in _read
    uncompress = self.decompress.decompress(buf)
zlib.error: Error -3 while decompressing: invalid distance too far back

Olivier Tilloy (osomon) wrote :

I’m not sure how to mark the bug as affecting Maverick and fixed in Natty, and it seems I cannot change the bug status now that I’ve marked it 'Fix Released'…
Anyway, I’m attaching a patch against lp:ubuntu/maverick-updates/software-center that fixes the crash.

Gary Lasker (gary-lasker) wrote :

Heya Olivier! :) Thanks a lot for the patch. I applied it to a branch for 3.0 and nominated this bug for maverick. This is good timing as we have another fix that we need to cherrypick for an SRU as well (bug 684077).

Thanks again!

Olivier Tilloy (osomon) wrote :

Awesome, thanks for your swiftness Gary!

Changed in software-center (Ubuntu):
importance: Undecided → Medium
Changed in software-center (Ubuntu Maverick):
status: New → Fix Committed
importance: Undecided → Medium
description: updated
description: updated
Changed in software-center (Ubuntu Maverick):
assignee: nobody → Gary Lasker (gary-lasker)
description: updated
description: updated
Changed in software-center (Ubuntu Maverick):
milestone: none → maverick-updates

Accepted software-center into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Changed in software-center (Ubuntu):
assignee: nobody → Olivier Tilloy (osomon)
Gary Lasker (gary-lasker) wrote :

I have verified this fix in software-center version 3.0.9 in maverick-proposed per the stated test procedure, and all seems fine. Thanks!

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package software-center - 3.0.9

software-center (3.0.9) maverick-proposed; urgency=low

  [ Gary Lasker ]
  * softwarecenter/db/,
    - track cataloged_time for items not in axi (e.g. for-purchase apps)
      so that they will show up in What's New, add/modify unit tests
      per the changes (LP: #684077)
    - fix icon display that have a "." in it (LP: #745942)
  * softwarecenter/db/,
    - fix screenshot issues for apps for purchase and update unit
      test (LP: #791932)

  [ Olivier Tilloy ]
  * softwarecenter/apt/
    - fix startup crash if the history file is corrupted (LP: #725186)
 -- Gary Lasker <email address hidden> Wed, 15 Jun 2011 22:35:43 -0400

Changed in software-center (Ubuntu Maverick):
status: Fix Committed → Fix Released
tags: added: testcase
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers