[Bug 1899195] Re: /usr/share/apport/apport:AttributeError:/usr/share/apport/apport at 451:parse_arguments:print_usage:_print_message
Brian Murray
1899195 at bugs.launchpad.net
Thu Oct 29 17:11:48 UTC 2020
Verification passed on Ubuntu 18.04 LTS.
bdmurray at clean-bionic-amd64:~$ apt list apport
Listing... Done
apport/bionic-proposed,bionic-proposed 2.20.9-0ubuntu7.19 all [upgradable from: 2.20.9-0ubuntu7.18]
N: There are 3 additional versions. Please use the '-a' switch to see them.
bdmurray at clean-bionic-amd64:~$ /usr/share/apport/apport '8219' '11' '0' '1' '8219' '!usr!bin!yes' '(deleted)'
usage: apport [-h] [-p PID] [-s SIGNAL_NUMBER] [-c CORE_ULIMIT] [-d DUMP_MODE]
[-P [GLOBAL_PID]] [-E [EXECUTABLE_PATH]]
bdmurray at clean-bionic-amd64:~$ sudo apt-get update &> /dev/null; sudo apt-get install apport python3-apport &> /dev/null
bdmurray at clean-bionic-amd64:~$ apt list apport
Listing... Done
apport/bionic-proposed,bionic-proposed,now 2.20.9-0ubuntu7.19 all [installed,automatic]
N: There are 3 additional versions. Please use the '-a' switch to see them.
bdmurray at clean-bionic-amd64:~$ /usr/share/apport/apport '8219' '11' '0' '1' '8219' '!usr!bin!yes' '(deleted)'
ERROR: apport (pid 2868) Thu Oct 29 10:11:04 2020: cannot create lock file (uid 1000): [Errno 13] Permission denied: '/var/run/apport.lock'
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to apport in Ubuntu.
https://bugs.launchpad.net/bugs/1899195
Title:
/usr/share/apport/apport:AttributeError:/usr/share/apport/apport at 451:parse_arguments:print_usage:_print_message
Status in apport package in Ubuntu:
Fix Released
Status in apport source package in Xenial:
Fix Committed
Status in apport source package in Bionic:
Fix Committed
Status in apport source package in Focal:
Fix Committed
Bug description:
Impact
------
apport is crashing for some users when a crash file is created about an executable which has been deleted.
Test Case
---------
While you won't get a Traceback (because there is a location for apport to print its usages message) with the following test case you will see apport usage printed:
$ PYTHONPATH=/home/bdmurray/source-trees/apport/trunk data/apport '8219' '11' '0' '1' '8219' '!usr!bin!yes' '(deleted)'
usage: apport [-h] [-p PID] [-s SIGNAL_NUMBER] [-c CORE_ULIMIT] [-d DUMP_MODE] [-P [GLOBAL_PID]]
With the fixed version of apport you'll see no such usage message.
Regression Potential
--------------------
Because new code is being added its possible that the python syntax could be bad which would result in another crash, so careful review the code.
Original Description
--------------------
The Ubuntu Error Tracker has been receiving reports about a problem regarding apport. This problem was most recently seen with package version 2.20.11-0ubuntu27.10, the problem page at https://errors.ubuntu.com/problem/290470c9cf5f278596966c386aac31e70a49988e contains more details, including versions of packages affected, stacktrace or traceback, and individual crash reports.
Traceback (most recent call last):
File "/usr/share/apport/apport", line 451, in <module>
options = parse_arguments()
File "/usr/share/apport/apport", line 396, in parse_arguments
parser.print_usage()
File "/usr/lib/python3.6/argparse.py", line 2370, in print_usage
self._print_message(self.format_usage(), file)
File "/usr/lib/python3.6/argparse.py", line 2381, in _print_message
file.write(message)
AttributeError: 'NoneType' object has no attribute 'write'
After working on https://bugs.launchpad.net/apport/+bug/1732962, the error tracker started throwing the error above.
it appears that print_usage is called and throwing an error because in this context (called with core_pattern) apport doesn't have an stdout or stderr. after looking at traces it seems the kernel is adding 'deleted' to the name of the process which cause argument parsing to fail.
The fix below from bdmurray seems to fix it.
https://paste.ubuntu.com/p/pVKNP9kWP4/
There is report of this issue in Focal, Bionic and xenial
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1899195/+subscriptions
More information about the foundations-bugs
mailing list