Skip to content

Commit 129ee40

Browse files
committed
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 <[email protected]>
1 parent 4b304dc commit 129ee40

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

winsup/cygwin/environ.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ static win_env conv_envvars[] =
323323
{NL ("HOME="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
324324
{NL ("LD_LIBRARY_PATH="), NULL, NULL,
325325
env_plist_to_posix, env_plist_to_win32, true},
326+
{NL ("ORIGINAL_PATH="), NULL, NULL, env_PATH_to_posix, env_plist_to_win32, true},
326327
{NL ("SHELL="), NULL, NULL, env_path_to_posix, env_path_to_win32, true, true},
327328
{NL ("TMPDIR="), NULL, NULL, env_path_to_posix, env_path_to_win32, false},
328329
{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] =
349350
0, 0, 0, 0, 0, 0, 0, 0,
350351
/* 72 */
351352
/* H I J K L M N O */
352-
WC, 0, 0, 0, WC, 0, 0, 0,
353+
WC, 0, 0, 0, WC, 0, 0, WC,
353354
/* 80 */
354355
/* P Q R S T U V W */
355356
WC, 0, 0, WC, WC, 0, 0, 0,

0 commit comments

Comments
 (0)