ppa-generate-keys broken due to unicode issue

Bug #576405 reported by Michael Nelson on 2010-05-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
High
Michael Nelson

Bug Description

Since the 10.04 rollout ppa-generate-keys script has been failing with:

{{{
2010-05-04 22:00:41 INFO Generating signing key for PPA for Kristian Klette
2010-05-04 22:02:32 DEBUG Removing lock file: /var/lock/launchpad-ppa-
generate-keys.lock
Traceback (most recent call last):
 File "/srv/launchpad.net/codelines/current/cronscripts/ppa-generate-
keys.py", line 21, in <module>
   script.lock_and_run()
 File "/srv/launchpad.net/codelines/ppa-
rev-9329/lib/lp/services/scripts/base.py", line 280, in lock_and_run
   implicit_begin=implicit_begin, isolation=isolation)
 File "/srv/launchpad.net/codelines/ppa-
rev-9329/lib/lp/services/scripts/base.py", line 238, in run
   self.main()
 File "/srv/launchpad.net/codelines/ppa-
rev-9329/lib/lp/soyuz/scripts/ppakeygenerator.py", line 62, in main
   self.generateKey(archive)
 File "/srv/launchpad.net/codelines/ppa-
rev-9329/lib/lp/soyuz/scripts/ppakeygenerator.py", line 33, in generateKey
   archive_signing_key.generateSigningKey()
 File "/srv/launchpad.net/codelines/ppa-
rev-9329/lib/lp/archivepublisher/archivesigningkey.py", line 75, in
generateSigningKey
   secret_key = getUtility(IGPGHandler).generateKey(key_displayname)
 File "/srv/launchpad.net/codelines/ppa-
rev-9329/lib/canonical/launchpad/utilities/gpghandler.py", line 307, in
generateKey
   secret_keys = list(self.localKeys(result.fpr, secret=True))
 File "/srv/launchpad.net/codelines/ppa-
rev-9329/lib/canonical/launchpad/utilities/gpghandler.py", line 402, in
localKeys
   for key in ctx.keylist(filter, secret):
TypeError: first argument must be a string or sequence of strings
}}}

Maxb says:

{{{
The new pygpgme's result.fpr is now a unicode object, but apparently the filter argument to keylist is still wanted as a bytestring.
}}}

Related branches

Michael Nelson (michael.nelson) wrote :

Although the fix itself is trivial as Max pointed out:

http://pastebin.ubuntu.com/429118/

Tests didn't fail because we don't actually call the real IGPGHandler.generateKey() - due to entropy needs (and general slowness). However, we're currently mocking a lot more than simply the gpgme.Context().genkey() call in our tests, and the code can be refactored so that the tests do test everything but that, and demonstrate this issue bug. I've got a branch that does this, but it needs a bit of work still, so in the mean time I'll try to get the above cowboy-ed.

Grepping for generateKey shows that it's only soyuz code that calls this (archivesigning and ppa key generation).

Changed in soyuz:
status: In Progress → Fix Committed
tags: added: qa-needstesting
tags: added: qa-ok
removed: qa-needstesting
Curtis Hovey (sinzui) on 2010-06-02
Changed in soyuz:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers