[PATCH] Display key UIDs in key listing even when --fast-list-mode is set.
Guilhem Moulin
guilhem at fripost.org
Tue Oct 14 21:44:10 CEST 2014
As it's already the done for --edit-key:
$ gpg --with-colons --fast-list-mode --edit-key $KEYID quit
This makes --fast-list-mode useful together with --list-sigs, as it's
shows on which UID the certificate signatures are added.
Using --fast-list-mode with --list-sigs can make the command
tremendously faster on large keyrings when the listed key(s) contains
many signatures.
Printing the key UIDs does not seem to add any significant performance
penalty to the old behavior of --fast-list-mode. This is not surprising
since UID packets are part of the OpenPGP Public-Key packet hence are
encountered during the listing anyway; printing the text doesn't require
extra lookup in the keyring (unlike displaying the primary UID of the
signing keys) or otherwise expensive computation (unlike trust or
validity calculation).
---
doc/gpg.texi | 10 +++++-----
g10/keylist.c | 8 ++++----
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/doc/gpg.texi b/doc/gpg.texi
index e7360e9..01abd1f 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -2762,11 +2762,11 @@ print the public key data.
@item --fast-list-mode
@opindex fast-list-mode
Changes the output of the list commands to work faster; this is achieved
-by leaving some parts empty. Some applications don't need the user ID
-and the trust information given in the listings. By using this options
-they can get a faster listing. The exact behaviour of this option may
-change in future versions. If you are missing some information, don't
-use this option.
+by leaving some parts empty. Some applications don't need the user ID of
+the signing keys and the trust information given in the listings. By
+using this options they can get a faster listing. The exact behaviour of
+this option may change in future versions. If you are missing some
+information, don't use this option.
@item --no-literal
@opindex no-literal
diff --git a/g10/keylist.c b/g10/keylist.c
index b5ea84d..29d7286 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -890,7 +890,7 @@ list_keyblock_print (KBNODE keyblock, int secret, int fpr, void *opaque)
for (kbctx = NULL; (node = walk_kbnode (keyblock, &kbctx, 0));)
{
- if (node->pkt->pkttype == PKT_USER_ID && !opt.fast_list_mode)
+ if (node->pkt->pkttype == PKT_USER_ID)
{
PKT_user_id *uid = node->pkt->pkt.user_id;
@@ -907,7 +907,7 @@ list_keyblock_print (KBNODE keyblock, int secret, int fpr, void *opaque)
dump_attribs (uid, pk);
if ((uid->is_revoked || uid->is_expired)
- || ((opt.list_options & LIST_SHOW_UID_VALIDITY) && pk))
+ || ((opt.list_options & LIST_SHOW_UID_VALIDITY) && !opt.fast_list_mode && pk))
{
const char *validity;
int indent;
@@ -1262,7 +1262,7 @@ list_keyblock_colon (KBNODE keyblock, int secret, int has_secret, int fpr)
for (kbctx = NULL; (node = walk_kbnode (keyblock, &kbctx, 0));)
{
- if (node->pkt->pkttype == PKT_USER_ID && !opt.fast_list_mode)
+ if (node->pkt->pkttype == PKT_USER_ID)
{
char *str;
PKT_user_id *uid = node->pkt->pkt.user_id;
@@ -1277,7 +1277,7 @@ list_keyblock_colon (KBNODE keyblock, int secret, int has_secret, int fpr)
es_fprintf (es_stdout, "%s:r::::", str);
else if (uid->is_expired)
es_fprintf (es_stdout, "%s:e::::", str);
- else if (opt.no_expensive_trust_checks)
+ else if (opt.fast_list_mode || opt.no_expensive_trust_checks)
es_fprintf (es_stdout, "%s:::::", str);
else
{
--
2.1.1
More information about the Gnupg-devel
mailing list