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

Re: GIT_ASKPASS absolute path detection bug on Windows

From
AKAndrás Kucsma <andras.kucsma@gmail.com>
Date
Mar 22, 2020, 18:33 UTC
Message-ID
<CANPdQvLQ4WFKmK+_Vys4EeBsRaFR+CcCJs_ARQX=JPzPLjxsWw@mail.gmail.com>
In-Reply-To
<20200322180730.57pe4awhglmmlxpm@tb-raspi4>
On Sun, Mar 22, 2020 at 7:07 PM Torsten Bögershausen <tboegi@web.de> wrote:
Show 8 quoted lines
> On Sun, Mar 22, 2020 at 04:59:15PM +0000, brian m. carlson wrote:
> > This function (locate_in_PATH) specifically says it is not to be used on
> > Windows because it doesn't work properly there due to file extensions.
>
> My reading is, that it dows work if you specify "foo.exe", "foo.bat".
> And when you specify "foo" it may use "foo.exe", but there may be
> a shell script called "foo".
> But I may be wrong.

Other than the extension appending, I believe the other difference is that on native Windows the PATH separator is ';' (semi-colon). In cygwin and mingw, PATH is translated to use ':' (colon).

Show 17 quoted lines
>
> > I'm pretty sure a proper solution would involve touching that as well,
> > although your solution does indeed fix the issue you reported.  That
> > function also uses a colon-separated PATH, which I'm not sure will work
> > in all cases on Windows (although maybe it will).
> >
> > From looking at this earlier, I think the problem here is that we're
> > trying to use the Unix codepaths (on Cygwin) and then expecting those to
> > handle Windows-style paths, which they aren't intended to do.  This is
> > likely one of many problems on Cygwin.
>
> Yes and no.
> C:/MyTool.BAT is a valid Windows file name even under Windows.
> Cygwin preferres /cygdrive/cMyTool.BAT
> Git under Cygwin should handle C:/MyTool.BAT correctly, and to my
> understanding it does.
>

Indeed, the Cygwin shell tools recognize C:/Users style and even C:\\Users style paths as well.

Looking at the code a bit more, I feel like git is only supposed to work within a Unix compatibility layer (like Cygwin or Mingw shell) on Windows. Beside the PATH and directory separator characters, the code makes other Unix like assumptions, for example that /bin/sh (a.k.a. SHELL_PATH), or /dev/null exists. If native Windows support is a goal, I'm happy to help a bit to improve the situation, but I wouldn't want to swim against the current. Note that other than this GIT_ASKPASS related edge case, cygwin built git has been working in this environment for me.

Previous: Torsten BögershausenNext: Achim Gratz
Message 6 of 9 in “GIT_ASKPASS absolute path detection bug on Windows”
  1. András KucsmaMar 21, 2020
  2. Torsten BögershausenMar 22, 2020
  3. András KucsmaMar 22, 2020
  4. brian m. carlsonMar 22, 2020
  5. Torsten BögershausenMar 22, 2020
  6. András KucsmaMar 22, 2020
  7. Achim GratzMar 22, 2020
  8. Torsten BögershausenMar 23, 2020
  9. András KucsmaMar 23, 2020

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.