Skip to content

Resolve bash by path so WSL's launcher never runs the test suite - #310

Merged
eugeniughelbur merged 1 commit into
eugeniughelbur:mainfrom
drakeo338:claude/308-fix
Sep 26, 2026
Merged

eugeniughelbur merged 1 commit into
eugeniughelbur:mainfrom
drakeo338:claude/308-fix

Conversation

@drakeo338

Copy link
Copy Markdown
Contributor

What this PR does

Fixes #308. On Windows with WSL installed, a bare "bash" in subprocess.run resolves through System32 before PATH and starts WSL's launcher, which mangles the Windows script path, so 45 tests failed. tests/_bash.py now resolves BASH = shutil.which("bash") or "bash" once, every test argv uses it (replacing three private copies of the same resolver), and scripts/conformance_report.py resolves it locally. tests/test_bash_pinned.py walks the suite's AST and fails if a bare "bash" comes back.

Type of change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Related issues

Closes #308

How I tested it

uv run pytest -q on 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

  • I searched existing issues and PRs before opening this one
  • My commit messages are descriptive (focus on WHY, not just WHAT)
  • I updated CHANGELOG.md (under "Unreleased") if applicable

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 eugeniughelbur left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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" when which finds 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 under Program 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:

  1. Fork-PR CI empty from here — first-time contributor workflow approve likely needed.
  2. 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.

@eugeniughelbur eugeniughelbur added bug Something isn't working area: python Scripts, lint gate, tooling labels Sep 24, 2026 — with Cursor
@eugeniughelbur
eugeniughelbur merged commit 8f379e4 into eugeniughelbur:main Sep 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: python Scripts, lint gate, tooling bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Windows with WSL installed: tests calling bare "bash" get WSL's bash, not Git Bash, and 45 tests fail

2 participants