Repository navigation
Preserve Unicode paths in the Windows LLVM builder - #2515
ItsNotRexed merged 4 commits into
Conversation
|
Code read of One side effect, new for this script ( AI-assisted review (Claude Code). |
|
The new Reproduce on this branch ( Result: Both of these make it pass with the variable set and unset (checked here): - b"call _build.cmd\r\nset \"build_exit=%errorlevel%\"\r\nchcp >after.txt\r\nexit /b %build_exit%\r\n"
+ b"call \"%~dp0_build.cmd\"\r\nset \"build_exit=%errorlevel%\"\r\nchcp >after.txt\r\nexit /b %build_exit%\r\n"
- ["cmd.exe", "/d", "/c", "check-console.cmd"], cwd=work, timeout=30,
+ ["cmd.exe", "/d", "/c", str(work / "check-console.cmd")], cwd=work, timeout=30,
|
|
Correction to my suggestion above, sorry: the absolute paths I proposed (now in An explicit relative name for the outer call avoids it. Your - ["cmd.exe", "/d", "/c", str(console_check)], cwd=work, timeout=30,
+ ["cmd.exe", "/d", "/c", r".\check-console.cmd"], cwd=work, timeout=30,Checked: this diff on |
Rebased on main (aa2988c). Since ItsNotRexed#2515 the llvm-mc test starts a check-console.cmd wrapper that calls _build.cmd, and the runtime half moved to tests/test_build_runtime_batch.py, which passes the full path. - test_build_llvm_mc_batch.py: r".\check-console.cmd" in Python and `call .\_build.cmd` in the wrapper, run with NoDefaultCurrentDirectoryInExePath=1. With that set, cmd.exe skips the current folder for a bare name; qualifying only the outer name still fails both exit-status subtests. - test_build_runtime_batch.py: r".\_build.cmd" instead of the full path, which cmd.exe /c splits when the temp folder holds ` & `. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
The native Windows LLVM builder writes
_build.cmdas ASCII. With a non-ASCII-Tempor tool path, that replaces characters with question marks before CMake starts. Write the batch file as UTF-8 without a BOM and switchcmd.exeto code page 65001 before the first path-bearing command.Coordination claim in #2300. This change is independently based on main. #2497 covers the separate runtime wrapper.
Verification
python -I -B tests/test_build_llvm_mc_batch.py -vreproduced the ASCII corruption before the fix and passed afterward. It checks the emitted bytes and runs the generated batch file with real Windows PowerShell andcmd.exe.python -I -B tests/test_llvm_install_destination.py -v,python -I -B tests/test_text_write_line_endings.py, andgit diff --checkpassed.-Temppath, MSVC 19.44, and the official Ninja 1.13.2 Windows binary. Configure, compilation, the probe call, and installation all completed. The WinLibs Ninja binary installed on this machine still mangled the path internally. This PR fixes the wrapper's encoding. The smoke test used a stand-in program and did not compile LLVM.AI-assisted with Codex.