[Bug 1977954] Re: apport_python_hook: Crashes if os.getcwd() throws FileNotFoundError
Benjamin Drung
1977954 at bugs.launchpad.net
Mon Jun 27 16:19:06 UTC 2022
** Also affects: apport (Ubuntu Jammy)
Importance: Undecided
Status: New
--
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/1977954
Title:
apport_python_hook: Crashes if os.getcwd() throws FileNotFoundError
Status in Apport:
Fix Released
Status in apport package in Ubuntu:
Fix Released
Status in apport source package in Jammy:
New
Bug description:
Example code:
```
#!/usr/bin/python3
import os
import tempfile
tempdir = tempfile.mkdtemp()
os.chdir(tempdir)
os.rmdir(tempdir)
os.getcwd()
```
Once executed:
```
$ /tmp/getcwd.py
Traceback (most recent call last):
File "/tmp/getcwd.py", line 9, in <module>
os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 76, in apport_excepthook
binary = os.path.realpath(os.path.join(os.getcwd(), sys.argv[0]))
FileNotFoundError: [Errno 2] No such file or directory
Original exception was:
Traceback (most recent call last):
File "/tmp/getcwd.py", line 9, in <module>
os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory
```
Another related issue: bug #1979637
To manage notifications about this bug go to:
https://bugs.launchpad.net/apport/+bug/1977954/+subscriptions
More information about the foundations-bugs
mailing list