NIIBE Yutaka gniibe at fsij.org
Tue Jan 15 04:06:22 CET 2013

I am bitten by my own change of:

    commit f6251c0d0af92331388f5e9bcd1750cbadcaca8f
    Author: NIIBE Yutaka <gniibe at fsij.org>
    Date:   Fri Dec 16 09:07:56 2011 +0900

        Don't kill pinentry by SIGKILL but let it quit by SIGINT.

        * agent/call-pinentry.c (agent_popup_message_stop): To pinentry, send
          SIGINT (was: SIGKILL).

The window of pinentry doesn't pop down, now.

This change was done because of pinentry-curses.  With
pinentry-curses, when it is killed by SIGINT, terminal gets confused.

I figured out that the problem here is signal mask.  To handle
signals, GPG-Agent has signal mask for SIGHUP, SIGUSR1, SIGUSR2,
SIGINT and SIGTERM.  Then, pinentry will be fork/exec-ed with this
signal mask, and SIGINT will not be delivered because of this mask.

We need to call pthread_atfork to unmask signals for child processes
of GPG-Agent.

I'm not sure where to implement unmasking signals.

It should be GnuPG which calls pthread_atfork for 2.0 branch.  But
it's common things among applications, it would be npth_sigev_fini
which calls pthread_atfork for master branch.

More information about the Gnupg-devel mailing list