I'm trying to use gpg under a few other layers in Git Annex, to decrypt a secret encrypted to multiple private keys. I have two of the possible decrypting keys installed: one protected by a passphrase, and the other not.
When I run my command, GPG insists on reaching up to the TTY from deep in whatever script is calling it and prompting for a passphrase for one of the keys, even though the other key is available without a passphrase.
Dropping no-tty in gpg.conf, or running the script without a controlling TTY just makes GPG die because it can't get to the TTY.
But if I ctrl+D through GPG's password prompts, GPG will fall back and use the other key that doesn't require a password.
GPG should be smart enough to try all the keys it has that aren't password-protected, before bothering the user for a password.
And if there is no controlling TTY, or no-tty is set, GPG should treat it as if the user canceled the passphrase prompt or didn't get a valid passphrase, instead of dying before trying the other keys.
I eventually had to delete the passphrase-protected key to get the script to run without hanging waiting for a passphrase, which is silly.