"History" screen spins forever if /var/log/apt/history.log is corrupt

Bug #666449 reported by Tyler Nieman on 2010-10-25
This bug affects 1 person
Affects Status Importance Assigned to Milestone
software-center (Ubuntu)

Bug Description

Ubuntu Software Center 3.0.5, Ubuntu 10.10
software-center trunk r2328, Ubuntu 11.10 beta 1

1. Make a backup copy of /var/log/apt/history.log.
2. In the original file, munge one of the timestamps, e.g. change "2011-09-02 19:03:18" to "2011-09-02 1".
3. Launch USC.
4. Choose "History".
5. Close USC and restore history.log from the backup.

What happens:
3. USC 3.0.5 fails to launch at all.
4. USC r2338 launches, but the "History" screen forever shows a spinner, and produces this traceback at the console:
Traceback (most recent call last):
  File "/home/mpt/hacking/software-center/softwarecenter/db/history_impl/apthistory.py", line 107, in _rescan
  File "/home/mpt/hacking/software-center/softwarecenter/db/history_impl/apthistory.py", line 125, in _scan
    trans = Transaction(stanza)
  File "/home/mpt/hacking/software-center/softwarecenter/db/history.py", line 45, in __init__
    "%Y-%m-%d %H:%M:%S")
  File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
    (data_string, format))
ValueError: time data '2011-09-02 2' does not match format '%Y-%m-%d %H:%M:%S'

What should happen: The "History" screen should show as many transactions as it can read. Any unparseable values should be shown as "unknown" or something like that.

Tyler Nieman (tsnieman) on 2010-10-25
description: updated
summary: - Software-center fails to launch because "time data" does not match
+ Software-center fails to launch because of "time data" does not match

I can't reproduce in 10.10 x86 some version of software center.
Can you try:

gksudo software-center


Tyler Nieman (tsnieman) wrote :

I get the same error when I run gksudo.

~$ gksudo software-center
    app = SoftwareCenterApp(datadir, xapian_base_path, options, args)
  File "/usr/share/software-center/softwarecenter/app.py", line 149, in __init__
    self.history = get_apt_history()
  File "/usr/share/software-center/softwarecenter/apt/apthistory.py", line 178, in get_apt_history
    apt_history = AptHistory()
  File "/usr/share/software-center/softwarecenter/apt/apthistory.py", line 83, in __init__
  File "/usr/share/software-center/softwarecenter/apt/apthistory.py", line 99, in rescan
  File "/usr/share/software-center/softwarecenter/apt/apthistory.py", line 116, in _scan
    trans = Transaction(stanza)
  File "/usr/share/software-center/softwarecenter/apt/apthistory.py", line 59, in __init__
    "%Y-%m-%d %H:%M:%S")
  File "/usr/lib/python2.6/_strptime.py", line 325, in _strptime
    (data_string, format))
ValueError: time data '2' does not match format '%Y-%m-%d %H:%M:%S'

Matthew Paul Thomas (mpt) wrote :

USC is now much more robust -- it launches, but it still spins forever trying to display the History. I'll revise the bug report.

description: updated
tags: removed: data format match mismatch software-center time
summary: - Software-center fails to launch because of "time data" does not match
+ "History" screen spins forever if /var/log/apt/history.log is corrupt
Changed in software-center (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
description: updated
Michael Vogt (mvo) on 2011-09-15
Changed in software-center (Ubuntu):
status: Triaged → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package software-center -

software-center ( oneiric; urgency=low

  [ Michael Vogt ]
  * softwarecenter/backend/reviews.py:
    - update review sorting to follow spec (wilson score)
  * lp:~mvo/software-center/retire-gtk2:
    - remove (no longer used) gtk2 code, this has the added benefit
      that all the checks for pygtk vs pygi are gone as well
    - update gir1.2-* dependencies (LP: #842616)
  * softwarecenter/ui/gtk3/views/appdetailsview_gtk.py:
    - wrap title instead of ellipsize (LP: #850857)
  * softwarecenter/toolkit.py:
    - update to current code
  * softwarecenter/backend/reviews.py:
    - do not crash for unknown deb names
  * softwarecenter/ui/gtk3/app.py:
    - make the locale code more robust (LP: #846038)
  * softwarecenter/db/history_impl/apthistory.py:
    - be more robust against broken history.log files (LP: #666449)
  * softwarecenter/backend/installbackend_impl/aptd.py:
    - be more robust about potential races (LP: #848676)
  * softwarecenter/ui/gtk3/models/pendingstore.py:
    - only add transactions if we get meaningful data

  [ Matthew McGowan ]
  * lp:~mmcg069/software-center/highcontrast-theme-improvements:
    - a host of improvements to the highcontrast themes
  * lp:~mmcg069/software-center/bug848845:
    - use the stock_zoom-page cursor, which in the currernt icon
      theme still presents as a magnifying glass (LP: #848845)
  * lp:~mmcg069/software-center/minor-vis-fixes:
    - even up the borders around a Frame (LP: #850780)

  [ Gary Lasker ]
  * softwarecenter/ui/gtk3/panes/installedpane.py:
    - implement a spinner for the installed view
 -- Michael Vogt <email address hidden> Thu, 15 Sep 2011 22:09:59 +0200

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

Other bug subscribers