git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* GIT_ASKPASS absolute path detection bug on Windows
@ 2020-03-21 11:42 András Kucsma
  2020-03-22  7:31 ` Torsten Bögershausen
  0 siblings, 1 reply; 9+ messages in thread
From: András Kucsma @ 2020-03-21 11:42 UTC (permalink / raw)
  To: git

Hi All,

I believe to have found an issue regarding properly executing the
GIT_ASKPASS binary. I'm using Windows Server 2019, with git 2.21.0
installed using cygwin.

## To reproduce:

Assume you have the askpass binary at C:\askpass.bat. In CMD the
following commands reproduce the issue:

C:\> set GIT_ASKPASS=C:\askpass.bat
C:\> git clone https://<private_repository>.git
Cloning into '<private_repository>'...
error: cannot run C:\askpass.bat: No such file or directory
[... proceeds to interactively ask for username and password ...]

On the other hand, if we change the GIT_ASKPASS environment variable
slightly, so that there is a forward slash (/) instead of a backslash
(\), things work as expected:

C:\> set GIT_ASKPASS=C:/askpass.bat
C:\> git clone https://<private_repository>.git
Cloning into '<private_repository>'...
[... success ...]

## Some context:

The source of the problem, is that if git doesn't find a forward slash
anywhere in the path, it assumes it is not a real path and has to look
for the binary using the PATH environment variable. See in
prepare_cmd():
https://github.com/git/git/blob/98cedd0233e/run-command.c#L429-L439

You can see that the "cannot run" error message is printed here, just
after prepare_cmd() returned -1:
https://github.com/git/git/blob/98cedd0233e/run-command.c#L749-L753

I believe this was introduced in late 2018 around git v2.19.2,
although I did not actually bisect the issue:
https://github.com/git/git/commit/321fd823897#diff-7577a5178f8cdc0f719e580577889f04R401-R415


I hope I'm sharing this bug at the right forum. Please direct me to
the proper place if not.

Thank you,
Andras

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-03-23 18:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-21 11:42 GIT_ASKPASS absolute path detection bug on Windows András Kucsma
2020-03-22  7:31 ` Torsten Bögershausen
2020-03-22 11:44   ` András Kucsma
2020-03-22 16:59     ` brian m. carlson
2020-03-22 18:07       ` Torsten Bögershausen
2020-03-22 18:33         ` András Kucsma
2020-03-22 18:59         ` Achim Gratz
2020-03-23 16:58     ` Torsten Bögershausen
2020-03-23 18:13       ` András Kucsma

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