MSYS2-packages/msys2-runtime-3.4/0030-Handle-ORIGINAL_PATH-just-like-PATH.patch
Christoph Reiter 14e5524bed Add msys2-runtime-3.4
This will be the msys2-runtime variant that still works on Win7.
2024-03-15 17:55:50 +01:00

49 lines
2.4 KiB
Diff

From 9ec56bee08c6cd617db655328002182f3990de71 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Tue, 21 Mar 2017 13:18:38 +0100
Subject: [PATCH 30/N] Handle ORIGINAL_PATH just like PATH
MSYS2 recently introduced that hack where the ORIGINAL_PATH variable is
set to the original PATH value in /etc/profile, unless previously set.
In Git for Windows' default mode, that ORIGINAL_PATH value is the used
to define the PATH variable explicitly.
So far so good.
The problem: when calling from inside an MSYS2 process (such as Bash) a
MINGW executable (such as git.exe) that then calls another MSYS2
executable (such as bash.exe), that latter call will try to re-convert
ORIGINAL_PATH after the previous call converted ORIGINAL_PATH from POSIX
to Windows paths. And this conversion may very well fail, e.g. when the
path list contains mixed semicolons and colons.
So let's just *force* the MSYS2 runtime to handle ORIGINAL_PATH in the
same way as the PATH variable (which conversion works, as we know).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/cygwin/environ.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index dad25b9..ffb1d5e 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -323,6 +323,7 @@ static win_env conv_envvars[] =
{NL ("HOME="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
{NL ("LD_LIBRARY_PATH="), NULL, NULL,
env_plist_to_posix, env_plist_to_win32, true},
+ {NL ("ORIGINAL_PATH="), NULL, NULL, env_PATH_to_posix, env_plist_to_win32, true},
{NL ("SHELL="), NULL, NULL, env_path_to_posix, env_path_to_win32, true, true},
{NL ("TMPDIR="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
{NL ("TMP="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
@@ -349,7 +350,7 @@ static const unsigned char conv_start_chars[256] =
0, 0, 0, 0, 0, 0, 0, 0,
/* 72 */
/* H I J K L M N O */
- WC, 0, 0, 0, WC, 0, 0, 0,
+ WC, 0, 0, 0, WC, 0, 0, WC,
/* 80 */
/* P Q R S T U V W */
WC, 0, 0, WC, WC, 0, 0, 0,