python3-apport will crash if current directory has been unlinked
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apport (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Description: Ubuntu 18.04.5 LTS
Release: 18.04
I have also checked the code for Ubuntu 20 and the specific code looks identical to me.
From package:
file: /usr/lib/
The follwing code will crash if current directory has been removed, os.getcwd() does not like that directory is gone:
# apport will look up the package from the executable path.
try:
binary = os.path.
except (TypeError, AttributeError, IndexError):
# the module has mutated sys.argv, plan B
try:
except OSError:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp_6ehbyrh'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/
binary = os.path.
FileNotFoundError: [Errno 2] No such file or directory
The try-except condition above maybe should also contain FileNotFoundError to handle this error.
Thanks for reporting this bug. I stumbled over the same bug and reported it as bug #1979637 (since I didn't noticed your bug report). This bug is fixed in Ubuntu 22.10 (kinetic) and will be backported to Ubuntu 22.04 (jammy). If you want to have it backported to older releases, please commit in #1979637.