Public bug reported:

In bug #1718582, a user has a corrupted ESP.  This leads to the shim-
signed apport hook crashing with the following error:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport/report.py", line 197, in _run_hook
    symb['add_info'](report, ui)
  File "/usr/share/apport/package-hooks/source_shim-signed.py", line 42, in 
add_info
    if directory:
UnboundLocalError: local variable 'directory' referenced before assignment

The relevant code is:

    try:
        directory = os.stat(efiboot)
    except OSError as e:
        if e.errno == errno.ENOENT:
            report['Missing'] = '/boot/efi/EFI/ubuntu directory is missing'
            return
        if e.errno == errno.EACCES:
            directory= True
    if directory:

If errno is anything other than ENOENT or EACCES, this crashes with the
above traceback.

It would probably be better to at least re-raise e if it doesn't match
one of our expected errnos.

** Affects: shim-signed (Ubuntu)
     Importance: Low
         Status: New

** Changed in: shim-signed (Ubuntu)
   Importance: Undecided => Low

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1718587

Title:
  shim-signed hook crashes under certain errors

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/shim-signed/+bug/1718587/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to