Thread (8 messages) 8 messages, 5 authors, 2021-12-02

Re: [PATCH] editor: only save (and restore) the terminal if using a tty

flat view

From: Carlo Arenas <hidden>
Date: 2021-11-23 17:31:34

On Tue, Nov 23, 2021 at 3:05 AM Phillip Wood [off-list ref] wrote:
I think a combination of isatty() and tcgetpgrp() is probably the best solution.
Definitely agree the long term fix needs to include tcgetpgrp() as
shown by this initial draft[1] (which I apologize, just noticed is
missing your "Helped-by")

That of course introduces a regression on the other direction though;
before this change, git compiled to use our getpass() replacement
(HAVE_DEV_TTY=1) function, the following will be normally stopped by a
SIGTTOU just like getpass() if running in the background (need to also
not have GIT_ASKPASS or SSH_ASKPASS defined in the environment)  :

  $ echo "https://user@example.com/" | git credential fill

I suspect that is probably fine though, as when that happens our
getpass() function still misbehaves if put back in the foreground
(unlike getpass()) and this "feature" might be undesired anyway as the
equivalent C code also runs sometimes in daemon-like processes, and
could even explain some of the workarounds put in place to disable
password prompts (ex: GIT_TERMINAL_PROMPT=0), but luckily we have all
the 2.35 dev cycle to figure out.

Restricting this feature further, maybe through a configuration
property or even special casing the EDITOR is also IMHO a good idea.

Carlo

[1] https://github.com/carenas/git/commit/64d15b2a74206f31e04cf0200f7be83a54a00517
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help