Page MenuHome GnuPG

gpg fails silently (on status fd) if no gpg-agent is running.
Closed, ResolvedPublic

Description

When no gpg-agent is running, gpg2 fails silently to sign a file. GPGME does
not report an error, and so doesn't GPA.

I guess GPGME could look at SIG_CREATED, but frankly I would appreciate it very
much if I could get one final result code per operation no matter what else
happens. This should be relatively easy to implement in gpg and is better than
ad-hoc rules that vary per operation.

$ gpg2 --status-fd 2 --sign ChangeLog
[GNUPG:] BEGIN_SIGNING H2
gpg: signing failed: Unknown IPC command
gpg: signing failed: Unknown IPC command

Event Timeline

I wonder how you created this problem. BEGIN_SIGNING is emitted after the agent
has been connected. The agent is also automatically started if not running; I
simulated a non-existing agent, using "--agent-program /bin/true":

$ ./gpg2 --status-fd 2 --sign -u 9CD9FD55 --agent-program /bin/false x
[GNUPG:] USERID_HINT 907B5D1640619DD0 Joe Random Hacker (test key with
passphrase "x") <joe@setq.org>
[GNUPG:] NEED_PASSPHRASE 907B5D1640619DD0 AF82244F9CD9FD55 1 0

You need a passphrase to unlock the secret key for
user: "Joe Random Hacker (test key with passphrase "x") <joe@setq.org>"
1024-bit RSA key, ID 40619DD0, created 2004-09-23 (main key ID 9CD9FD55)

can't connect to `/home/foo/.gnupg/S.gpg-agent': No such file or directory
can't connect server: ec=2.16383
gpg: can't connect to the agent: End of file
gpg: problem with the agent: No agent running
[GNUPG:] MISSING_PASSPHRASE
gpg: skipped "9CD9FD55": General error
gpg: signing failed: General error

No BEGIN_SIGNING but a MISSING_PASSPHRASE status.

In my case the actual key is on an openpgp card. That may explain the
difference we are seeing.

Marcus: I this still a problem with the SVN trunk?

werner claimed this task.
werner added a project: Too Old.