[Bug 1977954] Re: apport_python_hook: Crashes if os.getcwd() throws FileNotFoundError

Launchpad Bug Tracker 1977954 at bugs.launchpad.net
Mon Jun 27 14:31:06 UTC 2022


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

---------------
apport (2.22.0-0ubuntu1) kinetic; urgency=medium

  * New upstream release:
    - Replace `ProblemReport.get_date` by `ProblemReport.get_timestamp`, fixes
      regression in 2.21.0 (LP: #1978487)
    - apport-gtk: Exclude trailing dot from URL links (LP: #1978301)
    - Fix `AttributeError`: 'NoneType' object has no attribute 'write', fixes
      regression in 2.21.0 (LP: #1979211)
    - apport_python_hook: Properly handle missing modules (LP: #1774843)
    - apport_python_hook: Fix FileNotFoundError if the current directory was
      deleted (LP: #1979637)
    - apport_python_hook: Fix crash if os.getcwd() fails (LP: #1977954)
    - Replace deprecated 'imp' module (LP: #1947425)
    - whoopsie-upload-all: Fix 'EOFError' object has no attribute 'errno',
      fixes regression in 2.21.0 (LP: #1979681)
  * Fix KeyError: 'CasperMD5json'

 -- Benjamin Drung <bdrung at ubuntu.com>  Mon, 27 Jun 2022 12:03:00 +0200

** Changed in: apport (Ubuntu)
       Status: New => Fix Released

-- 
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

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