launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05834
[Merge] lp:~julian-edwards/launchpad/detailed-gpg-exceptions into lp:launchpad
Julian Edwards has proposed merging lp:~julian-edwards/launchpad/detailed-gpg-exceptions into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #798957 in Launchpad itself: "PPA Uploads are seemingly (but not actually) rejected"
https://bugs.launchpad.net/launchpad/+bug/798957
For more details, see:
https://code.launchpad.net/~julian-edwards/launchpad/detailed-gpg-exceptions/+merge/84642
Simple change to add extra debug output to the Poppy FTP handler when it fails to verify GPG signatures. This is to help debug bug 798957
--
https://code.launchpad.net/~julian-edwards/launchpad/detailed-gpg-exceptions/+merge/84642
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~julian-edwards/launchpad/detailed-gpg-exceptions into lp:launchpad.
=== modified file 'lib/canonical/launchpad/utilities/gpghandler.py'
--- lib/canonical/launchpad/utilities/gpghandler.py 2011-09-13 05:23:16 +0000
+++ lib/canonical/launchpad/utilities/gpghandler.py 2011-12-06 17:37:27 +0000
@@ -209,7 +209,12 @@
msg = e.strerror
else:
msg = e.message
- raise GPGVerificationError(msg)
+ error = GPGVerificationError(msg)
+ for attr in ("args", "code", "signatures", "source"):
+ if hasattr(e, attr):
+ value = getattr(e, attr)
+ setattr(error, attr, value)
+ raise error
# XXX jamesh 2006-01-31:
# We raise an exception if we don't get exactly one signature.
=== modified file 'lib/lp/poppy/twistedftp.py'
--- lib/lp/poppy/twistedftp.py 2011-04-29 06:47:43 +0000
+++ lib/lp/poppy/twistedftp.py 2011-12-06 17:37:27 +0000
@@ -167,6 +167,11 @@
sig = getUtility(IGPGHandler).getVerifiedSignatureResilient(
file(signed_file, "rb").read())
except GPGVerificationError, error:
+ log = logging.getLogger("poppy-sftp")
+ log.info("GPGVerificationError, extra debug output follows:")
+ for attr in ("args", "code", "signatures", "source"):
+ if hasattr(error, attr):
+ log.info("%s: %s" % (attr, error.attr))
return ("Changes file must be signed with a valid GPG "
"signature: %s" % error)
=== modified file 'lib/lp/registry/doc/gpg-signatures.txt'
--- lib/lp/registry/doc/gpg-signatures.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/registry/doc/gpg-signatures.txt 2011-12-06 17:37:27 +0000
@@ -181,3 +181,49 @@
["(7, 9, u'No public key')",
"(7, 9, u'No public key')",
"(7, 9, u'No public key')"]
+
+
+Debugging exceptions
+--------------------
+
+The GPGVerificationError exception object has some additional attributes
+with information about the error. These come directly from the gpgme module
+itself.
+
+ >>> from canonical.launchpad.interfaces.gpghandler import GPGVerificationError
+ >>> content = """
+ ... -----BEGIN PGP SIGNED MESSAGE-----
+ ... Hash: SHA1
+ ...
+ ... Test Message.
+ ... -----BEGIN PGP SIGNATURE-----
+ ... Version: GnuPG v1.4.1 (GNU/Linux)
+ ...
+ ... iD8DBQFD3xV52yWXVgK6XvYRAtJQAJ4ojuLC4aap4R9T0og17RkPYoND+ACfbCA3
+ ... yrZD6MZcqzyaGNy1s28Co2Q=
+ ... =5QGd
+ ... -----END PGP SIGNATURE-----
+ ... -----BEGIN PGP SIGNED MESSAGE-----
+ ... Hash: SHA1
+ ...
+ ... Some data appended by foo.bar@xxxxxxxxxxxxx
+ ... -----BEGIN PGP SIGNATURE-----
+ ... Version: GnuPG v1.4.1 (GNU/Linux)
+ ...
+ ... iD8DBQFD3xWpjn63CGxkqMURAmi6AJ4yHAnhIpt49VlYDG1uxpGy9BmHwwCeKbFM
+ ... aHIJLqhWVf8bGLHZBIH5odw=
+ ... =iUSC
+ ... -----END PGP SIGNATURE-----
+ ... """
+ >>> try:
+ ... gpghandler.getVerifiedSignature(content)
+ ... except GPGVerificationError, e:
+ ... print e.args
+ ... print e.code
+ ... print e.signatures
+ ... print e.source
+ (7, 89, u'Bad data')
+ 89
+ [<gpgme.Signature object at ...>]
+ 7
+