gpg argument "--passphrase=" yields 'missing argument for option "--passphrase="'
Testing, HighPublic

Description

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 <test@example.net>'

with:

gpg --pinentry-mode loopback --passphrase '' --quick-gen-key 'test user <test@example.net>'

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.

Related Objects

dkg created this task.Jul 17 2019, 12:53 AM
werner triaged this task as High priority.Jul 18 2019, 11:13 AM
gniibe claimed this task.Jul 19 2019, 10:20 AM
gniibe added a subscriber: gniibe.

Patch is pushed to master. Will be backported to 2.2.

gniibe changed the task status from Open to Testing.Jul 22 2019, 7:23 AM

Backported.