gnupg should notify cancellation of its operation to gpg-agent to kill pinentry
Closed, ResolvedPublic


When a user type Control-C to interrupt gpg operation (when pinentry-curses
dialog is active), gpg should shutdown pinentry gracefully.

Configure gpg-agent with pinentry-curses, minimum test case is:

   $ gpg --sign some.txt
   [Type Control-C, when you see curses dialog]

The pinentry process won't be killed by Control-C (because it doesn't have
controlling terminal).

Expected behavior is when gpg cancels its operation, it should notify
gpg-agent so that gpg-agent can cancel pinentry.

gniibe added a subscriber: gniibe.
werner added a subscriber: werner.Jun 16 2015, 9:07 AM

Actually there should be no need for gpg to notigy gpg-agent and thus pinentry
about a Ctrl-C. Due to Ctrl-C the gpg process dies and thus the connection to
gpg-agent receives an EOF/SIGPIPE and gpg-agent will shuot it down. Thus the
connection cleanup handler of gpg-agent needs to kill an open pinentry - I
tought this is already done.

Or is it the case that gpg does not see the Ctrl-C?

Just checked:

  /* Reset the pinentry (in case of popup messages). */
  agent_reset_query (ctrl);

Thus the pinentry is only closed if it is used as a simple popup winode (e.g.
"Insert card with serial number xxx") but not for a regular Pinentry.

neal added a subscriber: neal.Nov 20 2015, 1:32 PM

werner: What is your call to action? Should pinentry always be shutdown or is
the status quo acceptable? Thanks.

Keep the bug open. We won't fix it for the next release.

marcus removed marcus as the assignee of this task.Aug 15 2017, 5:45 PM
troc added a subscriber: troc.May 17 2018, 2:48 PM
gniibe claimed this task.Feb 19 2019, 3:55 AM

Fixed in master.

gniibe changed the task status from Open to Testing.Feb 19 2019, 8:17 AM
gniibe closed this task as Resolved.Jun 4 2019, 2:38 AM
dkg added a subscriber: dkg.Aug 20 2019, 2:43 AM

This appears to be and it does not appear to be fixed to me.

To replicate:

export GNUPHOME=$(mktemp -d)
echo pinentry-program /usr/bin/pinentry-curses > $GNUPGHOME/gpg-agent.conf
gpg --pinentry-mode=loopback --passphrase abc123 --batch --quick-gen-key 'test key'
echo test > $GNUPGHOME/test.txt
gpg --sign $GNUPGHOME/test.txt

then hit Ctrl-C,

dkg reopened this task as Open.Aug 20 2019, 2:44 AM
gniibe closed this task as Resolved.Dec 5 2019, 1:57 AM