shim-signed apport hook crashes under certain errors

Bug #1718587 reported by Steve Langasek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
shim-signed (Ubuntu)
New
Low
Unassigned

Bug Description

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.

Steve Langasek (vorlon)
Changed in shim-signed (Ubuntu):
importance: Undecided → Low
Steve Langasek (vorlon)
summary: - shim-signed hook crashes under certain errors
+ shim-signed apport hook crashes under certain errors
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.