Page MenuHome GnuPG

gpgconf --list-dirs --dry-run should not create the socket directory
Open, LowPublic

Description

When attempting to use a custom GPGHOME (specifically trying, without success, to get gnupg to respect XDG_CONFIG_HOME/gnupg), I discovered that the following:

export GNUPGHOME=[ anything ]
gpgconf --list-dirs --dry-run

... will always create the weirdly hashed socket dir in XDG_RUNTIME_DIR/gnupg.

I expect --create-socketdir to create the directory, I don't expect but at least somewhat understand --list-dirs doing it, but with the --dry-run flag there definitely should not be a directory created.

Details

Version
2.2.4

Event Timeline

werner added a project: gnupg.
werner added a subscriber: werner.

The --create-socketdir is not not anymore needed because the socket directory is meanwhile always created. We would need to handle the --dry-run in a special way here.

BTW. GnuPG does not know about XDG_RUNTIME_DIR:

/* It has been suggested to first check XDG_RUNTIME_DIR envvar.
 * However, the specs state that the lifetime of the directory MUST
 * be bound to the user being logged in.  Now GnuPG may also be run
 * as a background process with no (desktop) user logged in.  Thus
 * we better don't do that.  */

Rather surprised that it doesn't know about XDG_RUNTIME_DIR, as a stock install of gnupg on Arch will build its sockets in $XDG_RUNTIME_DIR/gnupg by default.

I was trying to use GNUPGHOME=$XDG_CONFIG_DIR/gnupg to attempt to keep my config in the same place as the majority of other programs these days, and was surprised to find that gpgconf automatically built the hashed directory in $XDG_RUNTIME_DIR/gnupg as well.

Regardless, the main point is that --dry-run shouldn't result in any changes on disk.

Thanks,

M

That is just coincidence, ie. XDG_RUNTIME_DIR must be set to /run/user/$UID on you box.

Ahh, yes you're right, in fact it is. Although after a bit of testing, Arch is both setting XDG_RUNTIME_DIR and respecting the XDG spec, and so is deleting that directory whenever any given user logs out. Given that, I'm not certain how any features of gnupg that expect /run/user/$UID to persist would work.