DistUpgradeApport.py causes an apport assertion error

Bug #1060353 reported by Brian Murray
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ubuntu-release-upgrader (Ubuntu)
Fix Released
Critical
Brian Murray
Oneiric
Invalid
Undecided
Unassigned
Precise
Invalid
Undecided
Unassigned
Quantal
Fix Released
Critical
Brian Murray
update-manager (Ubuntu)
Invalid
Undecided
Unassigned
Oneiric
Invalid
High
Unassigned
Precise
Fix Released
High
Brian Murray
Quantal
Invalid
Undecided
Unassigned

Bug Description

In the event that a distribution upgrade crashes apport_crash from DistUpgradeApport.py is called which then tries to attach files to the crash report (_apport_append_logfiles). However, key name for the file attachment in the report is formed using the directory '/var/log/dist-upgrade' which includes '/' in the key name. This causes apport to crash as seen here:

Traceback (most recent call last):
  File "DistUpgrade/DistUpgradeApport.py", line 120, in <module>
    apport_crash(None, None, None)
  File "DistUpgrade/DistUpgradeApport.py", line 57, in apport_crash
    _apport_append_logfiles(report)
  File "DistUpgrade/DistUpgradeApport.py", line 30, in _apport_append_logfiles
    report[ident] = (open(f), )
  File "/usr/lib/python2.7/dist-packages/problem_report.py", line 561, in __setitem__
    assert k.replace('.', '').replace('-', '').replace('_', '').isalnum()
AssertionError

because '/' is not alpha numeric. Apport should probably replace '/' but u-r-u / update-manager previously attached these files with specific names, like VarLogDistUpgradeApttermlog.txt, and the u-r-u / update-manager package hooks uses those same names. Subsequently, I thought it best to fix u-r-u to use the same key / attachment names.

= Impact =
When update-manager / u-ru crashes we are not receiving the log files we want from apport and probably we aren't even receiving crash reports from it.

= Test Case =
A simple test case is to manually call DistUpgradeApport.py:

1) touch /var/crash/_usr_bin_update-manager.0.crash
2) sudo python /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeApport.py (you need to do this via sudo to access the files)

With unfixed version of DistUpgradeApport.py you'll receive an assertion error, with the fixed version you won't. Additionally, if you look in '/var/crash' you'll find a file named '_usr_bin_update-manager.0.crash' which will include attachments and key names like 'VarLogDistUpgradeApporttermlog.txt'.

Revision history for this message
Brian Murray (brian-murray) wrote :

This is fall out from bug 1004503 and bug 954483.

Changed in ubuntu-release-upgrader (Ubuntu Quantal):
status: New → In Progress
importance: Undecided → Critical
assignee: nobody → Brian Murray (brian-murray)
Changed in update-manager (Ubuntu Quantal):
status: New → Invalid
Changed in ubuntu-release-upgrader (Ubuntu Oneiric):
status: New → Invalid
Changed in ubuntu-release-upgrader (Ubuntu Precise):
status: New → Invalid
Changed in update-manager (Ubuntu Oneiric):
status: New → Triaged
Changed in update-manager (Ubuntu Precise):
status: New → Triaged
Changed in update-manager (Ubuntu Oneiric):
importance: Undecided → High
Changed in update-manager (Ubuntu Precise):
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-release-upgrader - 1:0.186

---------------
ubuntu-release-upgrader (1:0.186) quantal; urgency=low

  * DistUpgradeApport.py: don't use a '/' as a key name in the apport report
    as this will cause an assertion error and prevent any attachments from
    being included (LP: #1060353)
 -- Brian Murray <email address hidden> Tue, 02 Oct 2012 10:57:22 -0700

Changed in ubuntu-release-upgrader (Ubuntu Quantal):
status: In Progress → Fix Released
description: updated
Changed in update-manager (Ubuntu Precise):
status: Triaged → In Progress
assignee: nobody → Brian Murray (brian-murray)
Revision history for this message
Adam Conrad (adconrad) wrote : Please test proposed package

Hello Brian, or anyone else affected,

Accepted update-manager into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/update-manager/1:0.156.14.11 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in update-manager (Ubuntu Precise):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
C de-Avillez (hggdh2) wrote :

verified before and after -- attachments are now included. Tagging verification-done

Revision history for this message
C de-Avillez (hggdh2) wrote :

erm, the above was for the Precise task. Verification-done for Precise, then.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Adam Conrad (adconrad) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package update-manager - 1:0.156.14.11

---------------
update-manager (1:0.156.14.11) precise-proposed; urgency=low

  * DistUpgradeApport.py: don't use a '/' as a key name in the apport report
    as this will cause an assertion error and prevent any attachments from
    being included (LP: #1060353)
 -- Brian Murray <email address hidden> Mon, 08 Oct 2012 16:02:53 -0700

Changed in update-manager (Ubuntu Precise):
status: Fix Committed → Fix Released
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote :

This actually does not seem to affect oneiric.

Changed in update-manager (Ubuntu Oneiric):
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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