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

Re: [PATCH] git_getpass: fix ssh-askpass behaviour

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 13, 2010, 00:41 UTC
Message-ID
<7voc8q7bdv.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1292157174-4033-2-git-send-email-alexander@sulfrian.net>
Alexander Sulfrian <alexander@sulfrian.net> writes:
> call ssh-askpass only if the display environment variable is also set
> ---

I do not use it at all so I don't know for sure, but doesn't this break OSX?

  20f3490 (web--browse: fix Mac OS X GUI detection for 10.6, 2009-09-14)

is an example that you can be fully graphical without having DISPLAY set in some environment. MinGW folks may want to chime in as well.

Show 28 quoted lines
>  connect.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/connect.c b/connect.c
> index 57dc20c..2810e3b 100644
> --- a/connect.c
> +++ b/connect.c
> @@ -621,7 +621,7 @@ int finish_connect(struct child_process *conn)
>  
>  char *git_getpass(const char *prompt)
>  {
> -	const char *askpass;
> +	const char *askpass, *display;
>  	struct child_process pass;
>  	const char *args[3];
>  	static struct strbuf buffer = STRBUF_INIT;
> @@ -631,7 +631,10 @@ char *git_getpass(const char *prompt)
>  		askpass = askpass_program;
>  	if (!askpass)
>  		askpass = getenv("SSH_ASKPASS");
> -	if (!askpass || !(*askpass)) {
> +
> +	/* only call askpass if display is set */
> +	display = getenv("DISPLAY");
> +	if (!display || !(*display) || !askpass || !(*askpass))
>  		char *result = getpass(prompt);
>  		if (!result)
>  			die_errno("Could not read password");
Previous: Alexander SulfrianNext: hvoigt
Message 5 of 8 in “git calls SSH_ASKPASS even if DISPLAY is not set”
  1. Xin WangDec 11, 2010
  2. RE: git calls SSH_ASKPASS even if DISPLAY is not setAlexander Sulfrian, Dec 12, 2010
  3. git_getpass: fix ssh-askpass behaviourAlexander Sulfrian, Dec 12, 2010
  4. Alexander SulfrianDec 12, 2010
  5. Junio C HamanoDec 13, 2010
  6. hvoigtDec 13, 2010
  7. Johannes SixtDec 13, 2010
  8. LarryMartellMay 7, 2012

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.