Hey.
As of 2.2.35 the manpage claims the following for --passphrase, --passphrase-file and --passphrase-fd:
Note that since Version 2.0 this passphrase is only used if the option --batch has also been given. Since Version 2.1 the --pinentry-mode also needs to be set to loopback.
Which I'd interpret as: as of 2.1, one needs both --batch and --pinentry-mode looback for the --passphrase-* options to work.
However, either of them seems to be already enough.
Apparently, this is a common question/problem for people (see e.g. https://stackoverflow.com/questions/55780390/how-to-pass-encrypted-message-and-passphrase-when-using-os-system-to-call-gpg or https://unix.stackexchange.com/questions/60213/gpg-asks-for-password-even-with-passphrase or https://dev.gnupg.org/T4020 ).
So could you perhaps clarify what's actually needed for which purpose?
My understanding was that --batch primarily causes no questions being asked interactively (not sure what this has to directly do with reading passphrases from arguments/FD/files and why --batch alone makes it already work).
The description of --pinentry-mode looback:
Redirect Pinentry queries to the caller. Note that in contrast to Pinentry the user is not prompted again if he enters a bad password.
is also not really clear IMO for an end-user. What exactly does it and why is it needed for the --passphrase-* options?
One difference:
When using --passphrase-* with --batch (alone), it won’t e.g. ask for confirmation about overwriting an output file. Whereas when using it with --pinentry-mode looback (alone), it would ask for such confirmation.
Thanks,
Chris.