Page MenuHome GnuPG

gpg returns "2" when unavailable to contact an agent, regardless of password fallback result.
Closed, ResolvedPublic


Release: Ubuntu Dapper's latest GPG as of 5/15/06


Ubuntu Dapper Drake (Linux 2.6, GCC 4.0, etc)


When GPG is unable to contact the agent specified in gnupg.conf, it will print "Unable To contact agent /path/to/socket: connection refused", then fall back to prompting for a passphrase.

If I enter a correct passphrase, it will then go ahead and perform the signature correctly. If not, it refuses (duh).

The problem is that regardless of whether or not the fallback passphrase was correct, gpg will always return 2, signifying a "fatal error". This is very misleading to other programs calling GPG and results in bug reports such as in bazaar-NG (

Upon password fallback succeeding, GPG should return 0 instead of 2.