Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH 1/2] git-svn, perl/Git.pm: add central method for prompting passwords honoring GIT_ASKPASS and SSH_ASKPASS

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:43

Sven Strickroth [off-list ref] writes:
Am 04.01.2012 08:55 schrieb Sven Strickroth:
quoted
The Git.pm part is easy, but I also tried to update prompt.c (untested).
I said "easy" and then I mailed the wrong/outdated patch :(
I'm sorry for the noise.

From: Sven Strickroth <redacted>
Date: Wed, 4 Jan 2012 08:44:48 +0100
Subject: [PATCH] Git.pm, prompt: try reading from interactive terminal
 before using SSH_ASKPASS

SVN tries to read reading from interactive terminal before using
SSH_ASKPASS helper. This change adjust git to behave the same way.
It might be an accurate description of what Subversion does ("tries to" is
the key phrase).  I however do not know if it is equivalent to what your
patch does.

When GIT_ASKPASS is not set, the $prompt is given to the standard error
stream unconditionally and then the "require Term::ReadKey" codepath is
used. When the terminal is unavailable, you might get undef in $ret and be
able to fall back on SSH_ASKPASS part, but you cannot take back the noise
you have given to the standard error stream.

Is there a way to ask Term::ReadKey (or possibly some other module) if we
will be able to interact with the terminal _before_ we give that prompt?

The simplest would be to do this, I would think, but I didn't test it.

	if (!defined $ret && -t) {
		print STDERR $prompt;
		if ($isPassword) {
                	...
	}
        if (!defined $ret) {
		$ret = _prompt($ENV{'SSH_ASKPASS'}, $prompt);
	}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help