AW: Cancel operation does not return error code

Schultschik, Sven sven.schultschik at siemens.com
Mon Mar 14 10:54:42 CET 2022


> -----Ursprüngliche Nachricht-----
> Von: Gnupg-users <gnupg-users-bounces at gnupg.org> Im Auftrag von Ingo
Klöcker
> Gesendet: Freitag, 11. März 2022 22:22
> An: gnupg-users at gnupg.org
> Betreff: Re: Cancel operation does not return error code
>
> On Freitag, 11. März 2022 17:05:44 CET Schultschik, Sven via Gnupg-users
> wrote:
> > > -----Ursprüngliche Nachricht-----
> > > Von: Gnupg-users <gnupg-users-bounces at gnupg.org> Im Auftrag von Ingo 
> > > Klöcker Gesendet: Freitag, 11. März 2022 11:18
> > > An: gnupg-users at gnupg.org
> > > Betreff: Re: Cancel operation does not return error code
> > > 
> > > [It would be great, if you wouldn't top-post even if this isn't easy 
> > > with Outlook or Office 365 or whatever email client you are using.]>
> > > > 3. Ctrl+C does not cancel the gpgme passphrase entry. See 
> > > > screenshot 2
> > > 
> > > Pressing Ctrl+C while t-encrypt-sym is running and pinentry-curses 
> > > is asking for the password quits pinentry-curses and t-encrypt-sym 
> > > without further output. That's common behavior for command line
programs.
> >
> > The problem is not that it quits without any further ouput. The 
> > problem is, that the command line is broken after a ctrl+c and the 
> > pinentry-curse is somehow still alife. You can't type or it is not 
> > visible. If you hit enter you get back to the pinentry saying that you
don't inserted any passwort.
>
> Hmm, I didn't observe this problem with t-encrypt-sym. Maybe using
pinentry- tty is an option. It's not as fancy as the curses one, but
hopefully it doesn't mess up the terminal on Ctrl+C.

I didn't saw that there is a possible choose between different pinentry
terminal modes. I thought there is only modes ASK or LOOPBACK to choose of
https://www.gnupg.org/documentation/manuals/gpgme/Pinentry-Mode.html#Pinentr
y-Mode
 
>
> > Is there a proper way or example how to cancel all operations on a 
> > ctrl-c signal?
>
> There is gpgme_cancel and gpgme_cancel_async:
>
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.gnupg.
org%2Fdocumentation%2Fmanuals%2Fgpgme%2FCancellation.html&data=04%7C01%7
Csven.schultschik%40siemens.com%
7C9be151e1b53748551dc108da03a5b0af%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C
0%7C637826308011207949%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV
2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=B%2FwuWdAQ%2FyWZa5AAP
7MTFxR7xbwdo%2Fl6iiREatwfIOE%3D&reserved=0
> But I don't know how to use them to cancel all operations on Ctrl+C.

I'm using the Cancel methods on ctrl+c but the terminal is anyway messed up.
Would it be worth a bug report?
I tried both gpgme_cancel and gpgme_cancel_async with same result.

/**
 * Clean Up after ctrl-c
 * 
 * @since 1.2.0
 * 
 * @param signum 
 */
void signal_callback_handler(int signum) 
{
    fprintf(stdout, "Interrupt signal caught\n"); 

    if (_ctx) {
        fprintf(stdout, "DEBUG cancel async");
        gpgme_error_t err = gpgme_cancel_async(_ctx);
        fail_if_err(err);
        _ctx = gpgme_wait(_ctx, &err, false);
        fail_if_err(err);
    }
   // Terminate program
   exit(signum);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 14944 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20220314/700a9167/attachment-0001.bin>


More information about the Gnupg-users mailing list