/usr/share/apport/whoopsie-upload-all:ValueError:/usr/share/apport/whoopsie-upload-all@249:main:collect_info:process_report:load

Bug #1995100 reported by errors.ubuntu.com bug bridge
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Apport
Fix Released
High
Unassigned
apport (Ubuntu)
Fix Released
High
Benjamin Drung
Kinetic
Fix Released
Undecided
Unassigned

Bug Description

Impact
======

apport-unpack and whoopsie-upload-all can crash when fed with a malformed problem report. They should print a proper error message instead of crashing. This is the most occurring apport bug in Ubuntu 22.10 (kinetic) with as of writing 14,822 reported crashes.

Test Plan
=========

1. Create malformed report:
```
echo > malformed.crash
```
2. Try to unpack it:
```
apport-unpack malformed.crash unpack
```

It should print an error message instead of a stack trace.

Where problems could occur
==========================

The patch touches the problem report handling and therefore can affect apport-unpack, apport-bug, whoopsie-upload-all. The change is covered with tests and apport has a test suite running during build and as autopkgtest.

Original report
===============

```
Traceback (most recent call last):
  File "/usr/share/apport/whoopsie-upload-all", line 249, in <module>
    main()
  File "/usr/share/apport/whoopsie-upload-all", line 231, in main
    stamps = collect_info()
  File "/usr/share/apport/whoopsie-upload-all", line 162, in collect_info
    res = process_report(r)
  File "/usr/share/apport/whoopsie-upload-all", line 76, in process_report
    r.load(f, binary="compressed")
  File "/usr/lib/python3/dist-packages/problem_report.py", line 166, in load
    (key, value) = line.split(b":", 1)
ValueError: not enough values to unpack (expected 2, got 1)
```

The Ubuntu Error Tracker has been receiving reports about a problem regarding apport. This problem was most recently seen with package version 2.23.1-0ubuntu3, the problem page at https://errors.ubuntu.com/problem/134ffbe13e7dd9a7f79ad6a455c6e560669a9928 contains more details, including versions of packages affected, stacktrace or traceback, and individual crash reports.
If you do not have access to the Ubuntu Error Tracker and are a software developer, you can request it at http://forms.canonical.com/reports/.

Revision history for this message
Benjamin Drung (bdrung) wrote :

An example .crash files that triggers this bug would be useful.

description: updated
Revision history for this message
Benjamin Drung (bdrung) wrote :

This can be reproduced by an "empty" .crash file which only contains a newline.

Changed in apport (Ubuntu):
importance: Undecided → High
Changed in apport:
importance: Undecided → High
tags: added: foundations-todo
Changed in apport (Ubuntu):
assignee: nobody → Benjamin Drung (bdrung)
Revision history for this message
Benjamin Drung (bdrung) wrote :
Changed in apport:
status: New → In Progress
Changed in apport (Ubuntu):
status: New → In Progress
Revision history for this message
Benjamin Drung (bdrung) wrote :
Changed in apport:
milestone: none → 2.24.0
status: In Progress → Fix Committed
Benjamin Drung (bdrung)
Changed in apport:
status: Fix Committed → Fix Released
Benjamin Drung (bdrung)
description: updated
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.24.0-0ubuntu1

---------------
apport (2.24.0-0ubuntu1) lunar; urgency=medium

  * New upstream bug-fix release.
    - Catch malformed problem reports (LP: #1996040)
    - Catch ValueError: not enough values to unpack (LP: #1995100)
    - Catch FileNotFoundError for missing desktop files (LP: #1997753)
    - Catch binascii.Error: Incorrect padding (LP: #1997912)
    - Catch AttributeError: NoneType object has no attribute origins
      (LP: #1997973)
  * Drop cherry-picked upstream patches
  * oem-getlogs: Use colon instead of a dot for chown command
  * Remove redundant section from apport-noui
  * Clarify that apport-noui is empty
  * Run black, isort, pydocstyle, pylint during package build

 -- Benjamin Drung <email address hidden> Thu, 08 Dec 2022 01:37:20 +0100

Changed in apport (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello errors.ubuntu.com, or anyone else affected,

Accepted apport into kinetic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/apport/2.23.1-0ubuntu3.1 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 on 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 add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-kinetic to verification-done-kinetic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-kinetic. In either case, without details of your testing we will not be able to proceed.

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

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in apport (Ubuntu Kinetic):
status: New → Fix Committed
tags: added: verification-needed verification-needed-kinetic
Revision history for this message
Benjamin Drung (bdrung) wrote :

Verified for kinetic:

```
$ echo > malformed.crash
$ apport-unpack malformed.crash unpack
ERROR: Malformed problem report: Line '\n' does not contain a colon for separating the key from the value.
```

tags: added: verification-done verification-done-kinetic
removed: verification-needed verification-needed-kinetic
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I verified the test results and am satisfied that they show the executed planned test case, and that the results are correct.

The package built correctly in all architectures and Ubuntu releases it was meant for.

There are no DEP8 regressions.

There is no SRU freeze ongoing at the moment.

There is no halted phasing on the previous update.

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

This bug was fixed in the package apport - 2.23.1-0ubuntu3.1

---------------
apport (2.23.1-0ubuntu3.1) kinetic; urgency=medium

  * Declare python3-apport breaking older apport/apport-gtk/apport-kde
    (LP: #1997759)
  * Catch malformed problem report (LP: #1996040)
  * Catch ValueError: not enough values to unpack (LP: #1995100)

 -- Benjamin Drung <email address hidden> Thu, 08 Dec 2022 02:38:15 +0100

Changed in apport (Ubuntu Kinetic):
status: Fix Committed → Fix Released
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Update Released

The verification of the Stable Release Update for apport has completed successfully and the package is now being 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 regressions.

Benjamin Drung (bdrung)
tags: removed: foundations-todo
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.