git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: "András Kucsma" <andras.kucsma@gmail.com>
Cc: "Torsten Bögershausen" <tboegi@web.de>, git@vger.kernel.org
Subject: Re: GIT_ASKPASS absolute path detection bug on Windows
Date: Sun, 22 Mar 2020 16:59:15 +0000	[thread overview]
Message-ID: <20200322165915.GA6499@camp.crustytoothpaste.net> (raw)
In-Reply-To: <CANPdQvK4LRZ2b_K0QuWErxNcc2wpW0W4zvmj3HzKDnOvgBNHfw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2025 bytes --]

On 2020-03-22 at 11:44:33, András Kucsma wrote:
> My proposal patch is to take advantage of find_last_dir_sep function's
> OS specific directory separator knowledge.
> I posted the diff below, which is also available on github here:
> https://github.com/git/git/compare/maint...r0mai:fix-prepare_cmd-windows-maint
> 
> diff --git a/run-command.c b/run-command.c
> index f5e1149f9b..9fcc12ebf9 100644
> --- a/run-command.c
> +++ b/run-command.c
> @@ -421,12 +421,12 @@ static int prepare_cmd(struct argv_array *out,
> const struct child_process *cmd)
>      }
> 
>      /*
> -     * If there are no '/' characters in the command then perform a path
> -     * lookup and use the resolved path as the command to exec.  If there
> -     * are '/' characters, we have exec attempt to invoke the command
> -     * directly.
> +     * If there are no dir separator characters in the command then perform
> +     * a path lookup and use the resolved path as the command to exec. If
> +     * there are dir separator characters, we have exec attempt to invoke
> +     * the command directly.
>       */
> -    if (!strchr(out->argv[1], '/')) {
> +    if (find_last_dir_sep(out->argv[1]) == NULL) {
>          char *program = locate_in_PATH(out->argv[1]);

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.
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.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  reply	other threads:[~2020-03-22 16:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20200322165915.GA6499@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=andras.kucsma@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=tboegi@web.de \
    /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).