Skip to content

Commit

Permalink
test: Convert Window path to MSYS path
Browse files Browse the repository at this point in the history
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
  • Loading branch information
klutzy committed Aug 23, 2014
1 parent a3d77e6 commit 7eb35bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/etc/maketest.py
Expand Up @@ -15,13 +15,14 @@
# msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
# `c:\real\abs\path1;c:\real\abs\path2` (semicolons) if shell thinks
# the value is list of paths.
# (if there is only one path, it becomes `c:/real/abs/path`.)
# this causes great confusion and error: shell and Makefile doesn't like
# windows paths so it is really error-prone. revert it for peace.
def normalize_path(v):
# c:\path -> /c/path
if ':\\' in v:
v = '/' + v.replace(':\\', '/')
v = v.replace('\\', '/')
# c:/path -> /c/path
if ':/' in v:
v = '/' + v.replace(':/', '/')
return v


Expand Down

5 comments on commit 7eb35bc

@bors
Copy link
Contributor

@bors bors commented on 7eb35bc Aug 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at klutzy@7eb35bc

@bors
Copy link
Contributor

@bors bors commented on 7eb35bc Aug 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging klutzy/rust/issue-15297 = 7eb35bc into auto

@bors
Copy link
Contributor

@bors bors commented on 7eb35bc Aug 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

klutzy/rust/issue-15297 = 7eb35bc merged ok, testing candidate = 36131f5

@bors
Copy link
Contributor

@bors bors commented on 7eb35bc Aug 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 36131f5

Please sign in to comment.