[Bug 1718587] [NEW] shim-signed hook crashes under certain errors

Steve Langasek steve.langasek at canonical.com
Thu Sep 21 06:05:46 UTC 2017


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
Foundations Bugs, which is subscribed to shim-signed in Ubuntu.
https://bugs.launchpad.net/bugs/1718587

Title:
  shim-signed hook crashes under certain errors

Status in shim-signed package in Ubuntu:
  New

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.

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



More information about the foundations-bugs mailing list