Opaque gpg failures

Bug #1389604 reported by Jeroen T. Vermeulen
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
simplestreams
Confirmed
Medium
Unassigned

Bug Description

I just hit this traceback from simplestreams 0.1.0~bzr341-0ubuntu1, as run from the uvtool sync command:

«
$ uvt-simplestreams-libvirt sync
Traceback (most recent call last):
  File "/usr/bin/uvt-simplestreams-libvirt", line 27, in <module>
    uvtool.libvirt.simplestreams.main()
  File "/usr/lib/python2.7/dist-packages/uvtool/libvirt/simplestreams.py", line 326, in main
    args.func(args)
  File "/usr/lib/python2.7/dist-packages/uvtool/libvirt/simplestreams.py", line 269, in main_sync
    tmirror.sync(smirror, initial_path)
  File "/usr/lib/python2.7/dist-packages/simplestreams/mirrors/__init__.py", line 82, in sync
    content, payload = reader.read_json(path)
  File "/usr/lib/python2.7/dist-packages/simplestreams/mirrors/__init__.py", line 40, in read_json
    return raw, self.policy(content=raw, path=path)
  File "/usr/lib/python2.7/dist-packages/uvtool/libvirt/simplestreams.py", line 258, in policy
    content, keyring=args.keyring)
  File "/usr/lib/python2.7/dist-packages/simplestreams/util.py", line 271, in read_signed
    raise e
subprocess.CalledProcessError: Command '['gpg', '--batch', '--verify', u'--keyring=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg', '-']' returned non-zero exit status 2
$
»

The error seems to have gone away by itself, but this bug isn't about that. The bug is here to say that it'd be very helpful to see gpg's standard error output.

One thing the error message does tell me is that this is not a case of a signature failing to verify. Because in that situation, gpg returns 1.

It looks to me like the invalid-signature error is the whole point of read_signed, so it seems unfair and confusing to lump that error in with systemic failures. I would suggest defining and documenting a specific exception class for "signature failed to verify." Then, uvtool would have the option of catching that error separately and presenting it in a friendlier form — while pulling out all the debugging stops for other failures.

Any legacy implementations of read_signed would still raise the old error, and legacy applications built on simplestreams wouldn't treat the new error specially. I don't know if that matters; the one incompatibility that comes to mind would be for applications that specifically catch CalledProcessError to deal with it specially.

Scott Moser (smoser)
Changed in simplestreams:
status: New → Confirmed
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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