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

Re: [PATCH v2] Fix dir sep handling of GIT_ASKPASS on Windows

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 26, 2020, 21:14 UTC
Message-ID
<xmqqmu82izt4.fsf@gitster.c.googlers.com>
In-Reply-To
<pull.587.v2.git.1585143910604.gitgitgadget@gmail.com>
"András Kucsma via GitGitGadget"  <gitgitgadget@gmail.com> writes:
Show 5 quoted lines
> From: Andras Kucsma <r0maikx02b@gmail.com>
>
> On Windows with git installed through cygwin, GIT_ASKPASS failed to run
> for relative and absolute paths containing only backslashes as directory
> separators.
> Subject: [PATCH v2] Fix dir sep handling of GIT_ASKPASS on Windows

Isn't it curious that there is nothing in the code that was touched that is specific to GIT_ASKPASS? We shouldn't have to see that in the title.

Perhaps
    Subject: run-command: notice needs for PATH-lookup correctly on Cygwin
    On Cygwin, the codepath for POSIX-like systems is taken in
    run-command.c::start_command().  The prepare_cmd() helper
    function is called to decide if the command needs to be looked
    up in the $PATH, and the logic there is to do the PATH-lookup if
    and only if it does not have any slash '/' in it.
    Unfortunately, a end-user can give "c:\program files\askpass" or
    "a\b\c" to be absolute or relative path to the command, but in
    these strings there is no '/'.  We end up attempting to run the
    command by appending the absoluter or relative path after each
    colon-separated component of $PATH.
    Instead, introduce a has_dir_sep(path) helper function to
    abstract away the difference between true POSIX and Cygwin, and
    use it to make the decision for PATH-lookup.
Having said all that, I am not sure if we need to change anything.

As Cygwin is about trying to mimicking UNIXy environment as much as possible, shouldn't "GIT_ASKPASS=//c/program files/askpass" the way end-users would expect to work, not the one that uses backslashes?

And if the user pretends to be on UNIXy system by using Cygwin by using slashes when specifying these commands run via the run_command API, the code makes the decision for PATH-lookup quite correctly, no?

So...
Previous: Junio C HamanoNext: András Kucsma
Message 7 of 13 in “Fix dir sep handling of GIT_ASKPASS on Windows”
  1. Fix dir sep handling of GIT_ASKPASS on WindowsAndrás Kucsma via GitGitGadget, Mar 23, 2020
  2. Junio C HamanoMar 24, 2020
  3. Fix dir sep handling of GIT_ASKPASS on WindowsAndrás Kucsma via GitGitGadget, Mar 25, 2020
  4. Torsten BögershausenMar 25, 2020
  5. András KucsmaMar 25, 2020
  6. Junio C HamanoMar 26, 2020
  7. Junio C HamanoMar 26, 2020
  8. András KucsmaMar 27, 2020
  9. run-command: trigger PATH lookup properly on CygwinAndrás Kucsma via GitGitGadget, Mar 27, 2020
  10. Junio C HamanoMar 27, 2020
  11. András KucsmaMar 27, 2020
  12. Andreas SchwabMar 27, 2020
  13. Junio C HamanoMar 27, 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.