--list-secret-keys abysmally slow
Closed, ResolvedPublic

Description

--list-secret-keys takes a lot of time in the latest development version:

sascha.silbe@twin:~$ time gpg2 --list-secret-keys
gpg: please do a --check-trustdb

/home/sascha.silbe/.gnupg/pubring.gpg

sec# 4096R/A13AC1B1 2008-06-03 [expires: 2013-06-02]
uid Sascha Silbe <sascha-pgp@silbe.org>
uid Sascha Silbe <silbe@activitycentral.com>
ssb# 2048R/2E966FF1 2008-06-03 [expires: 2013-06-02]
ssb# 2048R/4C1770DA 2008-06-03 [expires: 2013-06-02]
ssb 2048R/7775EB20 2010-03-07

real 0m11.769s
user 0m10.273s
sys 0m0.544s
sascha.silbe@twin:~$

This is on my fastest system, containing an Athlon X2 BE-2300. As it's entirely CPU bound I expect it to be much worse on my other systems.

2.0.14 OTOH is reasonably fast and lists a lot more keys (one of which isn't expired):

sascha.silbe@twin:~$ time /usr/bin/gpg2 --list-secret-keys
gpg: please do a --check-trustdb

/home/sascha.silbe/.gnupg/secring.gpg

sec 1024D/6135C35B 2000-06-15
uid Sascha Silbe <Sascha.Silbe@ldknet.org>
uid Old key - please use 74E5CF87 instead
ssb 2048g/876FE678 2000-06-15

sec 768R/E24E152D 1997-07-31
uid Sascha M. Silbe <Sascha_Silbe@pb.donut.de> - 768-Key
uid Sascha M. Silbe <postmaster@pb.donut.de> - 768-Key

sec 2048R/200B8F6D 1997-07-31
uid Sascha M. Silbe <Sascha_Silbe@pb.donut.de> - 2048-Key
uid Sascha M. Silbe <postmaster@pb.donut.de> - 2048-Key

sec 1024R/3BDC71ED 1997-07-31
uid Sascha M. Silbe <Sascha_Silbe@pb.donut.de> - 1024-Key
uid Sascha M. Silbe <postmaster@pb.donut.de> - 1024-Key

sec 1024R/7337BD6D 1999-06-12
uid Sascha Silbe <Sascha.Silbe@ldknet.org>
uid Old key - please use 74E5CF87 instead

sec 1024D/74E5CF87 2002-06-07 [expires: 2005-11-10]
uid Sascha Silbe <sascha@silbe.org>
uid Sascha Silbe <silbe@fsi.uni-tuebingen.de>
uid Sascha Silbe <silbe@informatik.uni-tuebingen.de>
uid Sascha Silbe <sascha.silbe@student.uni-tuebingen.de>
ssb 2048g/4623B45A 2002-06-07

sec 1024D/F9FB6446 2005-08-20 [expires: 2010-08-19]
uid Sascha Silbe <sascha-pgp@silbe.org>
ssb 2048g/56B5E5DA 2005-08-20
ssb 1024D/A57475A3 2007-02-09

sec 4096R/A13AC1B1 2008-06-03 [expires: 2013-06-02]
uid Sascha Silbe <sascha-pgp@silbe.org>
uid Sascha Silbe <silbe@activitycentral.com>
ssb 2048R/2E966FF1 2008-06-03
ssb 2048R/4C1770DA 2008-06-03
ssb 2048R/7775EB20 2010-03-07

sec 4096R/666005F4 2008-12-29 [expires: 2016-12-27]
[uid omitted for privacy reasons]

real 0m0.109s
user 0m0.016s
sys 0m0.044s
sascha.silbe@twin:~$

strace'ing gpg2 and gpg-agent suggests that all public keys are probed. With currently about 7k public keys in the ring (prior to an HD crash it was even more) it's clear why --list-secret-keys is that slow.

This is probably a known / expected issue (the gpg-agent protocol doesn't seem to have a command for listing secret keys), but I didn't find it documented anywhere.

Details

Version
git HEAD (7d24ffa)
sascha_silbe set Version to git HEAD (7d24ffa).
sascha_silbe added a subscriber: sascha_silbe.
werner added a subscriber: werner.

Please don't put bugs into the BTS for a development version. Use the
gnupg-devel@ mailing list instead.

werner closed this task as Resolved.
werner claimed this task.