Re: [PATCH v2 2/3] compat/mingw: implement a native locate_in_PATH()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Matthias Aßhauer via GitGitGadget"  <gitgitgadget@xxxxxxxxx>
writes:

> From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= <mha1993@xxxxxxx>
>
> since 5e1f28d (bisect--helper: reimplement `bisect_visualize()` shell
>  function in C, 2021-09-13) `git bisect visualize` uses exists_in_PATH()
> to check wether it should call `gitk`, but exists_in_PATH() relies on
> locate_in_PATH() which currently only understands POSIX-ish PATH variables
> (a list of paths, separated by colons) on native Windows executables
> we encounter Windows PATH variables (a list of paths that often contain
> drive letters (and thus colons), separated by semicolons). Luckily we do
> already have a function that can lookup executables on windows PATHs:
> path_lookup(). Implement a small replacement for the existing
> locate_in_PATH() based on path_lookup().
>
> Reported-by: Louis Strous <Louis.Strous@xxxxxxxxxxxxxxxx>
> Signed-off-by: Matthias Aßhauer <mha1993@xxxxxxx>
> ---
>  compat/mingw.c | 5 +++++
>  compat/mingw.h | 3 +++
>  2 files changed, 8 insertions(+)

Makes perfect sense ;-)

> diff --git a/compat/mingw.c b/compat/mingw.c
> index d06cdc6254f..bc3669d2986 100644
> --- a/compat/mingw.c
> +++ b/compat/mingw.c
> @@ -1347,6 +1347,11 @@ static char *path_lookup(const char *cmd, int exe_only)
>  	return prog;
>  }
>  
> +char *mingw_locate_in_PATH(const char *cmd)
> +{
> +	return path_lookup(cmd, 0);
> +}
> +
>  static const wchar_t *wcschrnul(const wchar_t *s, wchar_t c)
>  {
>  	while (*s && *s != c)
> diff --git a/compat/mingw.h b/compat/mingw.h
> index 209cf7cebad..b5262205965 100644
> --- a/compat/mingw.h
> +++ b/compat/mingw.h
> @@ -175,6 +175,9 @@ pid_t waitpid(pid_t pid, int *status, int options);
>  #define kill mingw_kill
>  int mingw_kill(pid_t pid, int sig);
>  
> +#define locate_in_PATH mingw_locate_in_PATH
> +char *mingw_locate_in_PATH(const char *cmd);
> +
>  #ifndef NO_OPENSSL
>  #include <openssl/ssl.h>
>  static inline int mingw_SSL_set_fd(SSL *ssl, int fd)




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux