setting expiration date changes primary UID (was: Re: GnuPG race causes misordered uids?

Marcus Brinkmann Marcus.Brinkmann at
Tue May 27 07:28:03 CEST 2003

On Mon, May 05, 2003 at 11:23:08PM -0400, David Shaw wrote:
> On Mon, May 05, 2003 at 08:40:46PM +0200, Marcus Brinkmann wrote:
> > I amnot sure if the way the keyring is generated even leads to a
> > deterministic order of user IDs.  But when I had the order as is in the
> > file, and just run the test (without rebuilding the keyring and everything),
> > I saw the buggy behaviour.
> Okay, I looked at this and what seems to be the problem is that some
> of the user IDs were generated in the same second.  That foils the
> current user ID sorting algorithm.

Now that is really embarrassing for me, but I didn't notice it before now
taking another look at this situation.  The problem only appeared in
conjunction with another test case, that did a small edit operation on the
key.  This reveals a completely unrelated bug in GPG.  Setting the
expiration date of a key changes the primary UID!

bash-2.05b$ GNUPGHOME=. gpg --edit-key Alpha
(1). Alpha Test (demo key) <alpha at>
(2)  Alfa Test (demo key) <alfa at>
(3)  Alice (demo key)

Command> expire
Key is valid for? (0) 0

(1)  Alpha Test (demo key) <alpha at>
(2). Alfa Test (demo key) <alfa at>
(3)  Alice (demo key)

This of course caused the keylisting test to fail.  Ouch!


`Rhubarb is no Egyptian god.' GNU    marcus at
Marcus Brinkmann              The Hurd
Marcus.Brinkmann at

More information about the Gnupg-devel mailing list