Skip to content

Commit 7eb35bc

Browse files
committed
test: Convert Window path to MSYS path
When MSYS shell executes program, if its arguments look like MSYS paths, MSYS automatically converts them into Windows paths. For example, `/c/path:/d/path` becomes `C:\path;D:\path`. However, if there is only one path e.g. `/c/path`, it becomes `C:/path`. maketest.py reverts the behavior to reduce confusion between MSYS and Windows, but it didn't handle the `/c/path` case. This patch fixes the issue. Fixes #15297 Fixes #15250
1 parent a3d77e6 commit 7eb35bc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/etc/maketest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
# msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
1616
# `c:\real\abs\path1;c:\real\abs\path2` (semicolons) if shell thinks
1717
# the value is list of paths.
18+
# (if there is only one path, it becomes `c:/real/abs/path`.)
1819
# this causes great confusion and error: shell and Makefile doesn't like
1920
# windows paths so it is really error-prone. revert it for peace.
2021
def normalize_path(v):
21-
# c:\path -> /c/path
22-
if ':\\' in v:
23-
v = '/' + v.replace(':\\', '/')
2422
v = v.replace('\\', '/')
23+
# c:/path -> /c/path
24+
if ':/' in v:
25+
v = '/' + v.replace(':/', '/')
2526
return v
2627

2728

0 commit comments

Comments
 (0)