OLD-7067: build scripts refuse a folder with % in its path up front #378

Manually merged
github merged 2 commits from gh-pr/378/head into gh-pr/378/base 2026-11-26 08:56:35 +00:00
Owner

@⁠lines9686-rgb on GitHub · 2026-11-24 04:11 UTC · original
lines9686-rgb:build-refuse-percent-path → main · +80 −0 · 4 files · 2 commits · merged 2026-11-24 06:32 UTC

Claimed in the coordination issue as: OLD-7067 (carried over from the original repository, same author)

What and why

A checkout with % in its path fails late and confusingly: cmd.exe expands %...% in the generated _build.cmd, and cl.exe rejects a % in the path-valued /D definitions of the runtime's test targets (D8038) however it is quoted (@⁠ezbyDev's measurements in the original repository). build_runtime.ps1 now stops before looking for Visual Studio when the checkout path has a %, and build_llvm_mc.ps1 when -Temp has one, each naming the folder; docs/testing.md gets a Known-problems row.

Tested

python tests/test_build_percent_path.py (runs both scripts with such a path, with git, python and vswhere hidden so a missing check cannot start a real build): OK on Windows 11.

GPUs tested: n/a

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (scripts/check_no_game_data.py over every changed file: clean).
  • A new translator rule is in the contract table of docs/design.md: n/a

🤖 Generated with Claude Code

**@⁠lines9686-rgb** on GitHub · 2026-11-24 04:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/378) `lines9686-rgb:build-refuse-percent-path` → `main` · +80 −0 · 4 files · 2 commits · merged 2026-11-24 06:32 UTC Claimed in the coordination issue as: `OLD-7067` (carried over from the original repository, same author) ### What and why A checkout with `%` in its path fails late and confusingly: `cmd.exe` expands `%...%` in the generated `_build.cmd`, and `cl.exe` rejects a `%` in the path-valued `/D` definitions of the runtime's test targets (D8038) however it is quoted (@⁠ezbyDev's measurements in the original repository). `build_runtime.ps1` now stops before looking for Visual Studio when the checkout path has a `%`, and `build_llvm_mc.ps1` when `-Temp` has one, each naming the folder; docs/testing.md gets a Known-problems row. ### Tested `python tests/test_build_percent_path.py` (runs both scripts with such a path, with git, python and vswhere hidden so a missing check cannot start a real build): OK on Windows 11. GPUs tested: n/a AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (`scripts/check_no_game_data.py` over every changed file: clean). - [x] A new translator rule is in the contract table of `docs/design.md`: n/a 🤖 Generated with [Claude Code](https://claude.com/claude-code)
cmd.exe expands %...% on every line of the generated _build.cmd (twice on a CALL line), and cl.exe rejects a % in the
path-valued /D definitions of the runtime's test targets (D8038) however it is quoted, so a checkout with % in its path
failed in configure, or a few hundred Ninja steps in once the batch was escaped (@ezbyDev's measurements in the original repository).
build_runtime.ps1 now stops before looking for Visual Studio when the checkout path has a %, and build_llvm_mc.ps1 when
-Temp has one, each naming the folder; docs/testing.md gets a Known-problems row. tests/test_build_percent_path.py runs
both scripts with such a path, with git, python and vswhere hidden so that a missing check can't start a real build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review by @QemmHD: a relative -Temp under a working directory with % skipped the check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:56:31 +00:00
github manually merged commit 2a4f650b7b into gh-pr/378/base 2026-11-26 08:56:35 +00:00
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 05:28 UTC · original

Adds only the two % path guards and their test: no URLs, downloads, elevation or execution-policy changes (the test's -ExecutionPolicy Bypass applies only to the child it starts). Safe. Nit: a relative -Temp under a working directory containing % skips the check.

Security review; read only, nothing run.
AI-assisted (Claude Code, Claude Opus 5.5).
Discord: bigpeppa.

**@⁠QemmHD** on GitHub · 2026-11-24 05:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/378#issuecomment-7122984811) Adds only the two `%` path guards and their test: no URLs, downloads, elevation or execution-policy changes (the test's `-ExecutionPolicy Bypass` applies only to the child it starts). Safe. Nit: a relative `-Temp` under a working directory containing `%` skips the check. Security review; read only, nothing run. AI-assisted (Claude Code, Claude Opus 5.5). Discord: bigpeppa.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 05:43 UTC · original

Tested on native Windows 11 (RTX 4070 SUPER), merged onto main 8f481cf16 (clean merge):

  • build_llvm_mc_* and build_runtime_* tests: 14 passed on main, 16 passed with this PR (the 2 new ones in tests/test_build_percent_path.py; python -I tests/test_build_percent_path.py is OK too). compileall clean.
  • Manual check in Windows PowerShell 5.1 with temp dirs: a checkout path containing p%q is refused ("contains '%'"), and so is -Temp a%b. Normal paths get past the guard and stop later where expected (missing vswhere or git; nothing was built).

Looks good to merge from my side once CI is green. The current macos and linux-gpu-tools failures are GPU shader tests on MoltenVK (cs_fma_fused, ps_ssharp, cs_imgload*_tfe), which this change doesn't touch; I'll confirm they fail on main too before merging.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-24 05:43 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/378#issuecomment-7123214451) Tested on native Windows 11 (RTX 4070 SUPER), merged onto main `8f481cf16` (clean merge): - `build_llvm_mc_*` and `build_runtime_*` tests: 14 passed on main, 16 passed with this PR (the 2 new ones in `tests/test_build_percent_path.py`; `python -I tests/test_build_percent_path.py` is OK too). `compileall` clean. - Manual check in Windows PowerShell 5.1 with temp dirs: a checkout path containing `p%q` is refused ("contains '%'"), and so is `-Temp a%b`. Normal paths get past the guard and stop later where expected (missing vswhere or git; nothing was built). Looks good to merge from my side once CI is green. The current `macos` and `linux-gpu-tools` failures are GPU shader tests on MoltenVK (`cs_fma_fused`, `ps_ssharp`, `cs_imgload*_tfe`), which this change doesn't touch; I'll confirm they fail on main too before merging. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠lines9686-rgb on GitHub · 2026-11-24 05:53 UTC · original

Thanks for the review and the Windows run. The nit is fixed in the new commit: build_llvm_mc.ps1 now checks the full path -Temp resolves to, so a relative -Temp under a working directory containing % is refused too. tests/test_build_percent_path.py gets that case (it fails without the change, passes with it); 3/3 OK on Windows 11.

The macos and linux-gpu-tools failures are the MoltenVK GPU shader tests you named; this PR touches neither.

**@⁠lines9686-rgb** on GitHub · 2026-11-24 05:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/378#issuecomment-7123376910) Thanks for the review and the Windows run. The nit is fixed in the new commit: `build_llvm_mc.ps1` now checks the full path `-Temp` resolves to, so a relative `-Temp` under a working directory containing `%` is refused too. `tests/test_build_percent_path.py` gets that case (it fails without the change, passes with it); 3/3 OK on Windows 11. The `macos` and `linux-gpu-tools` failures are the MoltenVK GPU shader tests you named; this PR touches neither.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 06:32 UTC · original

Merging. Why merged: the build scripts now refuse a checkout or -Temp folder whose path contains '%' up front, instead of failing later in confusing ways; the reviewer nit (a relative -Temp) was fixed in 2a4f650.
Why it's good: security-reviewed (only path guards and a test: no URLs, downloads, elevation or policy changes). Tested on Windows 11 (RTX 4070 SUPER) merged onto main 8f481cf: build_llvm_mc/build_runtime tests 14 passed on main -> 17 passed with this PR; compileall clean; in Windows PowerShell 5.1 a path with '%' and '-Temp a%b' are refused while normal paths pass the guard. The earlier CI failures (macos/linux-gpu-tools MoltenVK shader tests) are unrelated to these scripts.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-24 06:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/378#issuecomment-7124034708) Merging. Why merged: the build scripts now refuse a checkout or -Temp folder whose path contains '%' up front, instead of failing later in confusing ways; the reviewer nit (a relative -Temp) was fixed in 2a4f650. Why it's good: security-reviewed (only path guards and a test: no URLs, downloads, elevation or policy changes). Tested on Windows 11 (RTX 4070 SUPER) merged onto main 8f481cf: build_llvm_mc/build_runtime tests 14 passed on main -> 17 passed with this PR; compileall clean; in Windows PowerShell 5.1 a path with '%' and '-Temp a%b' are refused while normal paths pass the guard. The earlier CI failures (macos/linux-gpu-tools MoltenVK shader tests) are unrelated to these scripts. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.