Page MenuHome GnuPG

allow pinentry-program to use and expand ~ in path
Testing, NormalPublic


pinentry-program does not expand ~even though other parameters do. I'd like to add this to the code.

As for the use case: it is likely that a wrapper is used that is located in one's home dir:

pinentry-program ~/.local/bin/

Unfortunately with the current implementation the script is not found unless an absolute path is used. Using an absolute path might not seem so bad, but it can hinder bootstrapping gpg on different OS (e.g. Linux, macOS - /home/xxx vs /Users/xxx) without additional processing. I never understood why expanding the tilde was supported for some parameters but not all. I dislike inconsistency and hope that you would accept a PR for it - or whatever this is called in Phabricator.

What do you think? Is this a reasonable request?

Event Timeline

werner changed the task status from Open to Testing.Feb 27 2024, 10:40 AM
werner added a project: gnupg.
werner added a subscriber: werner.

Those options where originally intended for debugging but your suggestion makes sense. I also add this to most other tools.

FWIW, have a look at the gpgconf.ctl file

Under Unix ‘gpgconf.ctl’ may be used to change some of the
compiled in directories where the GnuPG components are expected.  This
file is expected in the same directory as ‘gpgconf’.  The
physical installation directories are evaluated and no symlinks.
Blank lines and lines starting with pound sign are ignored in the
file.  The keywords must be followed by optional white space, an equal
sign, optional white space, and the value.  Environment variables are
substituted in standard shell manner, the final value must start with
a slash, trailing slashes are stripped.  Valid keywords are
rootdir, sysconfdir, socketdir, and
.enable.  No errors are printed for unknown keywords.  The
.enable keyword is special: if the keyword is used and its
value evaluates to true the entire file is ignored.

Under Windows this file is used to install GnuPG as a portable
application.  An empty file named ‘gpgconf.ctl’ is expected in
the same directory as the tool ‘gpgconf.exe’.  The root of the
installation is then that directory; or, if ‘gpgconf.exe’ has
been installed directly below a directory named ‘bin’, its parent
directory.  You also need to make sure that the following directories
exist and are writable: ‘ROOT/home’ for the GnuPG home and
‘ROOT/usr/local/var/cache/gnupg’ for internal cache files.

This can be used to install GnuPG to an arbitrary location and override the compiled-in paths. The system makes use of this since 2.4.4

Oh wow. It seems you have already coded the feature request. I didn't want to generate work for you and offered to submit a patch. Not that I am complaining.;-) Thank you!