git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Carlo Arenas <carenas@gmail.com>, phillip.wood@dunelm.org.uk
Cc: git@vger.kernel.org, thomas.wolf@paranor.ch,
	Alexander Veit <alexander.veit@gmx.net>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] editor: only save (and restore) the terminal if using a tty
Date: Tue, 30 Nov 2021 11:07:40 +0000	[thread overview]
Message-ID: <7138fa14-02b2-b123-4d8d-df73763f8431@gmail.com> (raw)
In-Reply-To: <CAPUEsphP2GRaHJa0Qnvf22WUnNB+GnnfG8TgHqwJvSGdYfUQGA@mail.gmail.com>

On 23/11/2021 17:31, Carlo Arenas wrote:
> On Tue, Nov 23, 2021 at 3:05 AM Phillip Wood <phillip.wood123@gmail.com> 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())

Yes, I tried it out and I couldn't get it to work or figure out why. So 
long as we don't start echoing the password to the screen we should be 
fine. It would be nice to know what the problem is that stops it working 
properly but that is not really related to this patch.

> 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.

I think just doing this when we run the editor may be the way to go as I 
think it is only that case that can mess up the terminal.

Best Wishes

Phillip

> Carlo
> 
> [1] https://github.com/carenas/git/commit/64d15b2a74206f31e04cf0200f7be83a54a00517
> 


  reply	other threads:[~2021-11-30 11:07 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22  8:42 Update to Git 2.34.0 breaks application Alexander Veit
2021-11-22 21:43 ` Phillip Wood
2021-11-22 22:28   ` [PATCH] editor: only save (and restore) the terminal if using a tty Carlo Marcelo Arenas Belón
2021-11-22 22:47     ` Junio C Hamano
2021-11-22 23:03     ` Junio C Hamano
2021-11-22 23:08       ` Junio C Hamano
2021-11-23  8:52         ` Alexander Veit
2021-11-23  9:08           ` Carlo Arenas
2021-11-22 23:39       ` Carlo Arenas
2021-11-23 17:35         ` Junio C Hamano
2021-11-24 13:29           ` Johannes Schindelin
2021-11-24 18:25             ` Carlo Arenas
2021-11-24 19:34             ` Junio C Hamano
2021-11-24 20:04               ` Carlo Arenas
2021-11-24 20:51                 ` Junio C Hamano
2021-11-29 21:12               ` Johannes Schindelin
2021-11-23 11:05     ` Phillip Wood
2021-11-23 17:27       ` Junio C Hamano
2021-11-23 17:31       ` Carlo Arenas
2021-11-30 11:07         ` Phillip Wood [this message]
2021-12-01  5:12           ` Chris Torek
2021-12-01 19:33             ` Junio C Hamano
2021-12-02  0:38               ` Junio C Hamano
2021-12-02  1:51                 ` Carlo Arenas
2021-12-02 14:48             ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7138fa14-02b2-b123-4d8d-df73763f8431@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=alexander.veit@gmx.net \
    --cc=carenas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=thomas.wolf@paranor.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).