when GNUPGHOME points to a directory whose path is larger than
sockaddr_un.sun_path, daemons like gpg-agent and dirmngr cannot create their
sockets.
Currently we require the manual use of gpgconf --create-socketdir to switch over
to a shortened+digested path like /run/user/$(id
-u)/gnupg/d.ejnoxi4bi8ngqjaxw8jku8wz
This causes breakage in weird corner cases that people shouldn't have to know
about. On platforms where it can work, it should Just Work.
These shortened socketdirs should also get cleaned up automatically when the
associated daemons go away.
We also should support this common workflow:
- create a temporary GNUPGHOME for experimentation
- when done, do: rm -rf "$GNUGHOME"
- associated daemons all terminate
So my current proposal is:
- daemons create the ephemeral socketdir automatically if possible.
- clients try the ephemeral socketdir first, then fall back to in-$GNUPGHOME sockets (i think this is already the case).
- daemons watch the $GNUPGHOME with inotify, and auto-terminate if the $GNUPGHOME itself is destroyed.
- daemons try to rmdir() on the ephemeral socketdir on termination, failing quietly on ENOTEMPTY.
Please see discussion starting at:
https://lists.gnupg.org/pipermail/gnupg-users/2017-February/057692.html