trim_dpkg_log can crash with a TypeError

Bug #1080915 reported by Brian Murray on 2012-11-19
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
High
Brian Murray
Quantal
High
Brian Murray

Bug Description

[Impact]

Not all apport-package bug reports are having a DuplicateSignature created, which prevents the retracer from automatically marking duplicate bugs. Additionally, as the duplicate siganture is used to see whether or not a reporter has encountered the crash before (to prevent reporting) we may be receiving bug reports we do not want.

[Test Case]
1) Download python3-lxml.0.crash from this bug report
2
) Copy python3-lxml.0.crash to /var/crash
3) Run 'ubuntu-bug /var/crash/python3-lxml.0.crash'
4) Observe a Traceback in the terminal in which you ran ubuntu-bug

Repeat steps 1-4 using the version of apport from quantal-proposed and you will not see a Traceback. Do not submit the crash to Launchpad.

[Regression Potential]
Apport carries on in the event that there is an exception in package or general hooks, which is why this went undiscovered for a while, subsequently regressions would only occur in the DuplicateSignature creation.

= Orignal Description=

Some apport-package bug reports don't have a DuplicateSignature when they should. I was able to obtain a problematic crash file and running ubuntu-bug with I received the following traceback:

ERROR: hook /usr/share/apport/general-hooks/ubuntu.py crashed:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport/report.py", line 197, in _run_hook
    symb['add_info'](report, ui)
  File "/usr/share/apport/general-hooks/ubuntu.py", line 62, in add_info
    check_attachment_for_errors(report, attachment)
  File "/usr/share/apport/general-hooks/ubuntu.py", line 171, in check_attachment_for_errors
    trim_dpkg_log(report)
  File "/usr/share/apport/general-hooks/ubuntu.py", line 428, in trim_dpkg_log
    if start_re.match(line) or trim_re.match(line):
TypeError: can't use a bytes pattern on a string-like object

Changed in apport (Ubuntu Quantal):
status: New → Triaged
importance: Undecided → High
milestone: none → quantal-updates
Changed in apport (Ubuntu):
status: Triaged → In Progress
assignee: nobody → Brian Murray (brian-murray)
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.6.2-0ubuntu5

---------------
apport (2.6.2-0ubuntu5) raring; urgency=low

  * data/general-hooks/ubuntu.py: Deal with dpkg_log file being a string
    instead of bytes (LP: #1080915)
 -- Brian Murray <email address hidden> Mon, 19 Nov 2012 17:03:54 -0800

Changed in apport (Ubuntu):
status: In Progress → Fix Released
Brian Murray (brian-murray) wrote :

This attachment is a crash report that will produce the traceback we are trying to fix.

Changed in apport (Ubuntu Quantal):
assignee: nobody → Brian Murray (brian-murray)
status: Triaged → In Progress
description: updated
description: updated
Steve Langasek (vorlon) wrote :

Am having trouble understanding from context why the field would sometimes be a bytestring and sometimes be a string, and wondering if there's a more elegant way to fix this.

Hello Brian, or anyone else affected,

Accepted apport into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/apport/2.6.1-0ubuntu7 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 apport (Ubuntu Quantal):
status: In Progress → Fix Committed
tags: added: verification-needed
Brian Murray (brian-murray) wrote :

Hello Brian, or anyone else affected,

Accepted apport into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/apport/2.6.1-0ubuntu8 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!

Brian Murray (brian-murray) wrote :

Hello Brian, or anyone else affected,

Accepted apport into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/apport/2.6.1-0ubuntu9 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!

C de-Avillez (hggdh2) wrote :

Confirmed issue on stock Quantal (up-to-date on -updates, no -proposed); applied update to apport from quantal-proposed, re-run the test, no crash.

Tagging verification-done.

tags: added: verification-done
removed: verification-needed

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.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.6.1-0ubuntu9

---------------
apport (2.6.1-0ubuntu9) quantal-proposed; urgency=low

  * Fix OSError crash in mark_report_upload(); regression from
    2.6.1-0ubuntu8.

apport (2.6.1-0ubuntu8) quantal-proposed; urgency=low

  * Ignore implausibly low addresses when computing
    StacktraceAddressSignature. These are usually artifacts from gdb when not
    having debug symbols, and having too many of them prevents proper
    client-side duplicate detection and proper bucketing in daisy.
    Backported from trunk r2541. (LP: #1084996)
  * mark_report_upload(): Refresh the .upload stamps if a previous version of
    the report was already uploaded, but another instance of the problem
    happened since then. Thanks Brian Murray. Backported from trunk r2540.
    (LP: #1084296)

apport (2.6.1-0ubuntu7) quantal-proposed; urgency=low

  * data/general-hooks/ubuntu.py: Deal with dpkg_log file being a string
    instead of bytes (LP: #1080915)
 -- Martin Pitt <email address hidden> Wed, 05 Dec 2012 10:16:00 +0000

Changed in apport (Ubuntu Quantal):
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