Created attachment 332308 [details] Make gpg-agent startup use --write-env-file I'm tweaking KDE and keychain to play better together wrt. starting up gpg-agent. Currently when both are installed and enabled, a bunch of gpg-agents may end up running (and also left running after a KDE logout [0]) without a way to easliy access them, so they're there for no benefit. The first part of this is that kde-settings and keychain should agree on the format of ~/.gpg-agent-info. The best choice seems to me to be the format that gpg-agent --write-env-file writes, i.e. "GPG_AGENT_INFO=/tmp/..." instead of just "/tmp/...". The benefits of this format are ease of writing with gpg-agent --write-env-file, ease of sourcing in most shells, automatic support for cases where someone wants to use gpg-agent for SSH keys in addition to GPG ones, and a better match with upstream gpg-agent docs. The gpg-agent man page contains a bunch of examples regarding ~/.gpg-agent-info, most of which assume the GPG_AGENT_INFO=... format, except one which I think is bug/outdated and I've reported it upstream: https://bugs.g10code.com/gnupg/issue1002 The attached patch changes /etc/kde/env/gpg-agent-startup.sh to write and read ~/.gpg-agent-info in the GPG_AGENT_INFO=... format, using --write-env-file (available since gnupg2 1.9.17). When this is in, keychain can be trivially patched so that the end result is the expected: only one gpg-agent running, and environment properly set up to point to it. [0] Leaving the agent running after logout from KDE is actually sometimes desired, but that's a separate issue.
Thanks, I've been meaning to just this for quite awhile, but never quite got round-tuit.
fix included in kde-settings-4.2-3
Thanks. One question though: looks like "export GPG_TTY=$(tty)" was removed without a comment when applying the change, was that intentional? https://fedorahosted.org/kde-settings/changeset/29 That change was not in the patch I attached, reopening for clarification. And FWIW, --write-env-file ${GPG_AGENT_INFO_FILE} works for me (F-9) but I suppose there's no real harm in just using the default as was done in svn r30.
oops, not intentional.
GPG_TTY seems to be back in 4.2-4.20090225svn