On Sun, Feb 06, 2005 at 12:48:01AM +0100, Kurt Roeckx wrote:
> Package: gnupg
> Version: 1.4.0-1
>
> When updating keys that use the prefered keyserver field with
> --refresh-keys gpg will use that server to get the keys. It
> will however update the trustdb after it updated such keys and
> before it moves on to the next key to update.
>
> This behaviour is a little annoying.
Yes it is. Can you try this patch? If it works well, I'll put it
into 1.4.1.
David
Index: keyserver.c
===================================================================
RCS file: /cvs/gnupg/gnupg/g10/keyserver.c,v
retrieving revision 1.79
diff -u -r1.79 keyserver.c
--- keyserver.c 26 Jan 2005 21:20:30 -0000 1.79
+++ keyserver.c 6 Feb 2005 05:17:07 -0000
@@ -35,6 +35,7 @@
#include "ttyio.h"
#include "options.h"
#include "packet.h"
+#include "trustdb.h"
#include "keyserver-internal.h"
#include "util.h"
@@ -1628,11 +1629,17 @@
{
int rc,count,numdesc,fakev3=0;
KEYDB_SEARCH_DESC *desc;
+ unsigned int options=opt.keyserver_options.import_options;
- /* We switch merge_only on during a refresh, as 'refresh' should
- never import new keys, even if their keyids match. Is it worth
- preserving the old merge_only value here? */
- opt.import_options|=IMPORT_MERGE_ONLY;
+ /* We switch merge-only on during a refresh, as 'refresh' should
+ never import new keys, even if their keyids match. */
+ opt.keyserver_options.import_options|=IMPORT_MERGE_ONLY;
+
+ /* Similarly, we switch on fast-import, since refresh may make
+ multiple import sets (due to preferred keyserver URLs). We don't
+ want each set to rebuild the trustdb. Instead we do it once at
+ the end here. */
+ opt.keyserver_options.import_options|=IMPORT_FAST;
/* If refresh_add_fake_v3_keyids is on and it's a HKP or MAILTO
scheme, then enable fake v3 keyid generation. */
@@ -1696,6 +1703,20 @@
m_free(desc);
+ opt.keyserver_options.import_options=options;
+
+ /* If the original options didn't have fast import, and the trustdb
+ is dirty, rebuild. This is the same methodology used in
+ import.c:import_keys_internal(). */
+ if (!(opt.keyserver_options.import_options&IMPORT_FAST)
+ && trustdb_pending_check())
+ {
+ if(opt.interactive)
+ update_trustdb();
+ else if(!opt.no_auto_check_trustdb)
+ check_trustdb();
+ }
+
return rc;
}