Page MenuHome GnuPG

gnupg 2.1, gpg-agent crashing on 'assertion failed' (OS X, Homebrew)
Closed, ResolvedPublic

Description

Essentially duplicating the bug found [on GitHub](https://github.com/Homebrew/homebrew-
versions/issues/1255), but it seems that gpg-agent is crashing with a failed assertion,
causing signing to fail.

For me to reproduce:

$ killall gpg-agent && gpg-agent --debug 1024 --debug-pinentry --daemon /bin/sh

Then in another window:

$ gpg2 --sign

gpg: using "KEY" as default secret key for signing

hello world

gpg: signing failed: End of file

£õ¿¿¡e?ûL73ûóëöììØPû_îìgpg: signing failed: End of file

The log output can be found [in this gist]
(https://gist.github.com/gfontenot/5a57cec77088bd51dae4fb32f86b514e). Of note to me was
the ending line:

Assertion failed: (stream->flags.writing), function es_flush, file estream.c, line 
1873.

Note that the pinentry was displayed and completed, _then_ gpg-agent crashed.

You can see the configurations I have set up for gnupg 2.0 [in my dotfiles]
(https://github.com/gfontenot/dotfiles/tree/master/tag-pgp). I'm removing the gpg-agent
startup specific stuff for 2.1, but the rest is relatively unchanged (and generally
uninteresting).

Unfortunately, I need to go back to gnupg 2.0 in order to be able to continue to
work/send email, but I'll try to answer questions if I can.

Event Timeline

Which version of GnuPG are you using?

This is with gnupg 2.1.12, I don't have the same issue with gnupg 2.0.30

Thanks. I need a stack backtrace to find the location of the cause.
Please start gpg-agent using:

  gpg-connect-agent /bye

The figure out the PID of the gpg-agent process and run

  gdb /usr/local/bin/gpg-agent PID

At the gdb prompt enter

  handle SIGPIPE nostop noprint pass
  c

The "c" continues operation of gpg-agent. In another terminal run

  gpg2 --sign

as done in your example. GDB in the first terminal will eventually
stop due to the assert. Enter at the gdb prompt:

  bt

and post the output. I would also like to know which version of
libgpg-error you are using:

  gpg-error --version

should show this (or use gpg-error-config --version).

See bug 2371, which has a backtrace attached.

Sorry for going AWOL on this, Werner. Do you still need a backtrace from me, or is the
one from 2371 enough?

justus claimed this task.
justus added a project: gpgrt.
justus removed a project: gnupg.
justus added a subscriber: justus.

Yes, that is very likely the same bug. Feel free to reopen this report if yuo
can still reproduce it, in which case a backtrace would be very handy.

Fixed in 28fd0ab.