Public bug reported:

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:python3-apport
file: /usr/lib/python3/dist-packages/apport_python_hook.py

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.realpath(os.path.join(os.getcwd(), sys.argv[0]))
        except (TypeError, AttributeError, IndexError):
            # the module has mutated sys.argv, plan B                           
                                                                                
                                                   
            try:
                binary = os.readlink('/proc/%i/exe' % os.getpid())
            except OSError:
                return


FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp_6ehbyrh'
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


The try-except condition above maybe should also contain FileNotFoundError to 
handle this error.

** Affects: apport (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to apport in Ubuntu.
https://bugs.launchpad.net/bugs/1925478

Title:
  python3-apport will crash if current directory has been unlinked

Status in apport package in Ubuntu:
  New

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:python3-apport
  file: /usr/lib/python3/dist-packages/apport_python_hook.py

  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.realpath(os.path.join(os.getcwd(), sys.argv[0]))
          except (TypeError, AttributeError, IndexError):
              # the module has mutated sys.argv, plan B                         
                                                                                
                                                     
              try:
                  binary = os.readlink('/proc/%i/exe' % os.getpid())
              except OSError:
                  return

  
  FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp_6ehbyrh'
  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

  
  The try-except condition above maybe should also contain FileNotFoundError to 
handle this error.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1925478/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to