Repository navigation
Resolve bash by path so WSL's launcher never runs the test suite - #310
Merged
Merged
Conversation
On a Windows machine with WSL installed, subprocess.run(["bash", ...])
does not start Git Bash. CreateProcess searches System32 before PATH,
and System32\bash.exe is WSL's launcher, so the hook or build script's
Windows path reached a Linux bash that read every backslash as an
escape and reported "No such file or directory". shutil.which("bash")
on the same machine returns Git Bash. 45 tests failed this way, and
scripts/conformance_report.py built the platforms the same way.
Three test modules had already hit this and each carried a private
copy of the resolver. tests/_bash.py now resolves bash once, and every
subprocess argv in the suite starts with BASH. The external-engine
test quotes the resolved path into RETRIEVAL_EVAL_EXTERNAL_CMD, since
Git Bash lives under Program Files. conformance_report.py resolves
locally, because a script does not import from tests/. On macOS and
Linux nothing changes: which returns the bash a bare name would have
started.
tests/test_bash_pinned.py reads the suite's AST and fails on an argv
that starts with the literal "bash", a command string handed to a
subprocess environment that starts with "bash ", or a second copy of
the resolver in a test module. On the previous main it names 37 call
sites, the environment string and the three copies. The expected argv
values in the external-command split test are data, not calls, and
are left alone.
Closes eugeniughelbur#308
Co-Authored-By: Claude Fable 5.1 <[email protected]>
eugeniughelbur
left a comment
Owner
There was a problem hiding this comment.
First review (comment only — no approve / merge)
What it does: Implements the #308 suggested fix. One shared tests/_bash.py resolver (BASH = shutil.which("bash") or "bash"), every suite argv that started bash now uses it, scripts/conformance_report.py resolves locally the same way, and tests/test_bash_pinned.py AST-fences bare "bash" argv / env strings plus duplicate which("bash") copies.
Looks good:
- Matches the CreateProcess-vs-PATH diagnosis on the issue. Falls back to bare
"bash"whenwhichfinds nothing (macOS/Linux unchanged in practice). - Collapses the three private resolvers (
test_osb_env,test_python_interpreter,test_setup_settings_hook) into one helper — the drift risk the fence exists to stop. - Quotes the resolved path into
RETRIEVAL_EVAL_EXTERNAL_CMD(needed when Git Bash lives underProgram Files). CHANGELOG Unreleased entry is present and clear. - Linux claim: 973 → 977 passed (new guard tests). Windows+WSL still rests on the issue reproduction, which is fine given the mechanism.
Before merge:
- Fork-PR CI empty from here — first-time contributor workflow approve likely needed.
- Optional later (not blocking this PR): Windows CI job so this class of regression is caught without a reporter.
Needs owner yes to merge. Not merging from this triage. Closes #308 when merged.
This was referenced Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Fixes #308. On Windows with WSL installed, a bare
"bash"insubprocess.runresolves through System32 before PATH and starts WSL's launcher, which mangles the Windows script path, so 45 tests failed.tests/_bash.pynow resolvesBASH = shutil.which("bash") or "bash"once, every test argv uses it (replacing three private copies of the same resolver), andscripts/conformance_report.pyresolves it locally.tests/test_bash_pinned.pywalks the suite's AST and fails if a bare"bash"comes back.Type of change
Related issues
Closes #308
How I tested it
uv run pytest -qon Linux: 973 passed on main, 977 passed on this branch. The new guard test fails on main, naming 37 call sites. I have no Windows+WSL machine here, so the Windows side rests on the diagnosis in the issue.Checklist
CHANGELOG.md(under "Unreleased") if applicable