git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Alexander Sulfrian <alexander@sulfrian.net>
Cc: git@vger.kernel.org, Heiko Voigt <hvoigt@hvoigt.net>
Subject: Re: [PATCH] git_getpass: fix ssh-askpass behaviour
Date: Sun, 12 Dec 2010 16:41:00 -0800	[thread overview]
Message-ID: <7voc8q7bdv.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1292157174-4033-2-git-send-email-alexander@sulfrian.net> (Alexander Sulfrian's message of "Sun\, 12 Dec 2010 13\:32\:54 +0100")

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.

>  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");

  parent reply	other threads:[~2010-12-13  0:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-11  3:24 git calls SSH_ASKPASS even if DISPLAY is not set Xin Wang
2010-12-12 12:32 ` [RFC/PATCH] " Alexander Sulfrian
2010-12-12 12:32 ` [PATCH] git_getpass: fix ssh-askpass behaviour Alexander Sulfrian
2010-12-12 13:07   ` Alexander Sulfrian
2010-12-13  0:41   ` Junio C Hamano [this message]
2010-12-13 22:00     ` hvoigt
2010-12-13  9:48   ` Johannes Sixt
2012-05-07 21:42 ` git calls SSH_ASKPASS even if DISPLAY is not set LarryMartell
  -- strict thread matches above, loose matches on Subject: below --
2010-12-13  4:09 [PATCH] git_getpass: fix ssh-askpass behaviour Xin Wang

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=7voc8q7bdv.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=alexander@sulfrian.net \
    --cc=git@vger.kernel.org \
    --cc=hvoigt@hvoigt.net \
    /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).