Page MenuHome GnuPG

gpg argument "--passphrase=" yields 'missing argument for option "--passphrase="'
Closed, ResolvedPublic


I've got some test suites i'm working on that rely on secret keys with no passphrase set. compare the following:

gpg --pinentry-mode=loopback --passphrase='' --quick-gen-key 'test user <>'


gpg --pinentry-mode loopback --passphrase '' --quick-gen-key 'test user <>'

the latter works as expected, but the former fails with:

gpg: missing argument for option "--passphrase="

It's not clear why an empty string is acceptable as an independent element in argv[] but is not acceptable as a suffix to a --passphrase= element in argv[].

This is particularly aggravating for anyone writing tests or scripts in languages where passing an empty argument as an independent string is more complicated. for example, in simple POSIX shell, a common pattern is to accumulate a list of arguments to hand off to gpg in a single environment variable as a whitespace-delimited string.