Repository navigation
Honor MSYS_NO_PATHCONV given as a command prefix, and add pwd -W - #10
Conversation
4330b9c to
c8e3248
Compare
run_external read MSYS_NO_PATHCONV and MSYS2_ARG_CONV_EXCL from shell variables only, so the usual prefix form (MSYS_NO_PATHCONV=1 cmd ...) was ignored while an unexported variable did count. Like Git Bash's MSYS runtime, they now count when exported or given as a prefix. pwd -W prints the physical directory in Windows form (C:/...), as MSYS bash does. -L, -P and -W combine and the last one wins, and an invalid option is reported with exit status 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c8e3248 to
8e3225e
Compare
hex2f
left a comment
There was a problem hiding this comment.
Thanks for this. The env/prefix handling and pwd -W both match Git Bash. One thing about the test, line comment below.
I merged it onto current main. When MSYS_NO_PATHCONV isn't set, the new script matches the Git Bash output and the rest of the suite passes.
Behaviour change (FYI): a plain unexported MSYS_NO_PATHCONV=1 no longer turns off conversion. That's correct and matches Git Bash, but it's worth a line in the release notes, since it can break someone's .bashrc.
| @@ -0,0 +1,22 @@ | |||
| # MSYS_NO_PATHCONV and MSYS2_ARG_CONV_EXCL count when exported or given as a command prefix, | |||
| # as in Git Bash. pwd -W prints the current directory in Windows form. | |||
| git rev-parse --sq-quote /c/x | |||
There was a problem hiding this comment.
Test isn't hermetic. If MSYS_NO_PATHCONV=1 is already exported when the suite runs, this line gets no conversion and the script fails. Claude Code exports it, and some Git for Windows setups do too. With the variable unset, it passes. Suggestion: start the script with unset MSYS_NO_PATHCONV MSYS2_ARG_CONV_EXCL. Or, to fix this for every script, add both names to REMOVED_ENV in tests/compat.rs and to regen_expected.ps1.
With the variable exported, lines 3 and 5 of the script both print '/c/x' where 'C:/x' is expected.
The script expected conversion on, so it failed when MSYS_NO_PATHCONV or MSYS2_ARG_CONV_EXCL was already exported, as Claude Code does. It now unsets both first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks! Fixed: the script now starts with |
|
Thanks, that fixes it. I merged df22526 onto current main, which now includes #6 and #9, and it merges cleanly. With |
It sat right after `msys_child`, where hex2f#10 also adds lines, so the two changes conflicted. Declared a few lines up, they merge in either order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two small gaps with Git Bash that turned up while testing #1–#3.
MSYS_NO_PATHCONVandMSYS2_ARG_CONV_EXCLrun_externalread them from shell variables only. So the usual prefix form (MSYS_NO_PATHCONV=1 docker run -v /c/src:/src ...) was ignored, while an unexportedMSYS_NO_PATHCONV=1did count. Git Bash's MSYS runtime sees them in the environment a program starts with, so they now count when exported or given as a prefix, and not as plain shell variables.pwd -WMSYS bash's
pwd -Wprints the physical directory in Windows form (C:/Windows/System32). gash ignored-Wand printed the MSYS path; it now supports it. As in Git Bash,-L,-Pand-Wcan be combined and the last one wins (pwd -LWprints the Windows form,pwd -WPthe MSYS one), and an invalid option is reported with exit status 2.Tests
072_pathconv_env_pwd_w.sh, with expected output from Git Bash 5.3.15 viaregen_expected.ps1. For the conversion it usesgit rev-parse --sq-quoteas a native program that echoes its arguments, with no variable, a prefix, an unexported and an exported variable, andMSYS2_ARG_CONV_EXCLboth as a prefix and exported. Forpwdit covers-W,-LW,-WP,-P,-Land an invalid option. It fails with v0.1.0 and passes with this branch.cargo testpasses: unit tests, 66/66 compat scripts andmsys_tmp.