[PATCH] Display key UIDs in key listing even when --fast-list-mode is set.

Guilhem Moulin guilhem at fripost.org
Wed Sep 10 09:15:20 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 8ea8199..f7dede5 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -2807,11 +2807,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 2728308..d0ac953 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -820,7 +820,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
       print_key_data( pk );
 
     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;
 
 	    if(pk && (uid->is_expired || uid->is_revoked)
@@ -836,7 +836,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
 	      dump_attribs(uid,pk,sk);
 
 	    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;
@@ -1126,7 +1126,7 @@ list_keyblock_colon( KBNODE keyblock, int 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 ) {
 	    PKT_user_id *uid=node->pkt->pkt.user_id;
 	    if(attrib_fp && node->pkt->pkt.user_id->attrib_data!=NULL)
 	      dump_attribs(node->pkt->pkt.user_id,pk,sk);
@@ -1144,7 +1144,7 @@ list_keyblock_colon( KBNODE keyblock, int secret, int fpr )
         	    printf("%s:r::::",str);
                 else if ( uid->is_expired )
         	    printf("%s:e::::",str);
-		else if ( opt.no_expensive_trust_checks )
+		else if ( opt.fast_list_mode || opt.no_expensive_trust_checks )
         	    printf("%s:::::",str);
                 else {
 		    int uid_validity;
-- 
2.1.0




More information about the Gnupg-devel mailing list