Page MenuHome GnuPG

User ID ordering in --list-secret-keys behaving inconsistently
Closed, ResolvedPublic

Description

Release: 1.2.1

Environment

Debian GNU/Linux Sid, updated today, January 29th, 2003.

Using GnuPG 1.2.1 as packaged by Debian.

Confirmed using 1.2.2rc1.

Description

I have a key with two user ID's. The primary user ID was the last one added, so it comes last in the key.

When I do a "gpg --list-secret-keys", the oldest user ID is shown first, instead of the primary one. However, if I do run "gpg --list-secret-keys <pattern>", the user ID's are displayed in the right order.

Attached I send a test secret key that illustrates the problem and an example of what I get.

How To Repeat

$ gpg --list-secret-keys
/home/guest/.gnupg/secring.gpg


sec 1024D/799E7BD4 2002-12-03 A Test <test@test.com>
uid A Test 2 <test2@test.com>
ssb 1024g/A39BE550 2002-12-03

$ gpg --list-secret-keys test
sec 1024D/799E7BD4 2002-12-03 A Test 2 <test2@test.com>
uid A Test <test@test.com>
ssb 1024g/A39BE550 2002-12-03

Fix

No fix.

The problem is that keylist.c:reorder_keyblock can't work due to a missing primary key flag. We can't easily set this flag becuase getkey.c:merge_keys_and_selfsig does only fully work for public keys. Eventually we will remove the secret key listing and replace it by a public key listing of all keys for which a secret key exists. This is the way gpgsm handles it and demanded due to the introducion of the gpg-agent.

Event Timeline

Not easy to fix. Anyway with 1.9 we are going to change the
way secret keys are handled.

Will be changed with 1.9. No fix in 1.4.

werner removed a project: Stalled.