git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] gpg-interface: reflect stderr to stderr

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Sep 7, 2016, 09:32 UTC
Message-ID
<225f43eb-d708-dd9b-77d9-aa8cbe2cd9f1@drmicha.warpmail.net>
In-Reply-To
<20160907083947.b7q7ebe62xsr6447@sigill.intra.peff.net>
Jeff King venit, vidit, dixit 07.09.2016 10:39:
Show 13 quoted lines
> On Wed, Sep 07, 2016 at 10:27:34AM +0200, Michael J Gruber wrote:
> 
>> Now, I can't reproduce C on Linux[*], so there is more involved. It
>> could be that my patch just exposes a problem in our start_command()
>> etc.: run-command.c contains a lot of ifdefing, so possibly quite
>> different code is run on different platforms.
> 
> Maybe, though my blind guess is that it is simply that on Linux we can
> open /dev/tty directly, and console-IO on Windows is a bit more
> complicated.
> 
> You might also check your GPG versions; between gpg1.x and gpg2, the
> passphrase input handling has been completely revamped.
That's a good point to note.

gpg1 asks for the passphrase (without use-agent), gpg2 always delegates to gpg-agent (and starts it on demand).

On Linux, gpg-agent says you should
export GPG_TTY=$(tty)
to make gpg-agent find the tty, and claims it's not necessary on Win.

In fact, it's not necessary on Linux either unless you want to use pinentry-curses.

Alas, be it gpg1.4.21 or gpg2.1.13, whatever pinentry, I do get the passphrase prompt, even with curses (if GPG_TTY is set, which was necessary before any patches already).

I put up a request for more input from the reporters in the github issue. I guess that's the best way to reach them.

Show 15 quoted lines
>> It would be great if someone with a Windows environment could help our
>> efforts in resolving issue C, by checking what is actually behind[**]: I
>> can't believe that capturing stderr keeps gpg from reading stdin, but
>> who knows. Maybe Jeff of pipe_command() fame? I'll put him on cc.
> 
> I know nothing about Windows, but I'd be surprised if gpg is reading
> from stdin, as opposed to /dev/tty. It's probably more to do with how
> gpg finds the "tty" on Windows (presumably it looks at stderr for that).
> 
> Anyway, I wrote pipe_command() in such a way as to be prepared for
> exactly this kind of thing, so it would be trivial to extend it to an
> extra descriptor. The trouble is that run_command() doesn't understand
> anything except stdin/stdout/stderr. We can open an extra pipe() before
> calling run_command(), and make sure it is not marked CLOEXEC. I don't
> know if there are other portability concerns, though.

My suggestion to try "--status-fd=3" was meant to test whether the above could help: If fd=3 helps, then our capturing stderr is not the problem. (If fd=3 does not help then we still don't know...)

Michael
Previous: Jeff KingNext: Junio C Hamano
Message 9 of 16 in “Unbreak interactive GPG prompt upon signing”
  1. Unbreak interactive GPG prompt upon signingJohannes Schindelin, Sep 6, 2016
  2. Michael J GruberSep 6, 2016
  3. gpg-interface: reflect stderr to stderrMichael J Gruber, Sep 6, 2016
  4. Johannes SchindelinSep 6, 2016
  5. Johannes SchindelinSep 6, 2016
  6. Johannes SchindelinSep 6, 2016
  7. Michael J GruberSep 7, 2016
  8. Jeff KingSep 7, 2016
  9. Michael J GruberSep 7, 2016
  10. Junio C HamanoSep 8, 2016
  11. Jeff KingSep 8, 2016
  12. Junio C HamanoSep 8, 2016
  13. Michael J GruberSep 12, 2016
  14. Johannes SchindelinOct 2, 2018
  15. Johannes SchindelinSep 9, 2016
  16. Johannes SchindelinSep 6, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.