Repository navigation
build_runtime.ps1: do not CALL cmake.exe, so ^ in the checkout path is kept (BUILD-3554 follow-up) - #6622
build_runtime.ps1: do not CALL cmake.exe, so ^ in the checkout path is kept (BUILD-3554 follow-up)#6622Krille2004zzz wants to merge 3 commits into
Conversation
cmd's CALL doubles ^ in the rest of the line, so a checkout under a path with ^ failed at configure. Keep CALL only for .cmd/.bat wrappers so those still return to _build.cmd.
SirKingg
left a comment
There was a problem hiding this comment.
Independent Windows review (AI-assisted): the executable path is fixed in the synthetic tests, but the supported batch-wrapper fallback still corrupts caret-containing paths, as detailed inline.
Windows PowerShell 5.1 and cmd.exe, no game data: python -I tests\test_build_runtime_fallback.py passed 9 tests; python -I tests\test_build_runtime_batch.py passed 1 test. A synthetic harness executed the PR's actual helper, CMake command generation, batch writer and launcher with fake .exe/.cmd/.bat tools: 30/54 combinations preserved the expected arguments and status, while 24/54 failed the argument/path checks for batch wrappers with a caret in the checkout, wrapper or Ninja path. Configure/build failures were injected separately: the driver stopped on configure failure, stopped after build failure, and reported nonzero status where the tool was reached. A negative control using the original call for the executable reproduced the doubled caret.
This was not a full invocation of build_runtime.ps1 or an actual CMake/MSVC runtime build: VS discovery, tool probing in the complete script, real Ninja and GPU behavior were not exercised. The existing Windows path-discovery test did run. No GPU or game files were used.
| function Get-BatchCommand([string]$Tool) { | ||
| # cmd's CALL doubles ^ in the remaining command (#3554). Use it only for .cmd/.bat so | ||
| # those wrappers return; cmake.exe is invoked quoted, with no CALL. | ||
| if ($Tool -match '\.(cmd|bat)$') { return "call `"$Tool`"" } |
There was a problem hiding this comment.
Could the batch-wrapper case preserve ^ too, with an execution test? On Windows, a fake cmake.cmd or cmake.bat selected here receives caret^^dir\runtime for a checkout at caret^dir (both configure and build); a caret in the Ninja path is doubled too. If the wrapper's own path contains ^, call cannot find it. The .exe branch preserves these paths. This is a pre-existing limitation of call, not a new regression, but the fallback remains exposed to the same failure this PR addresses.
There was a problem hiding this comment.
The wrapper path now uses cmd /d /s /c ""wrapper" args" instead of CALL, so a ^ in the wrapper, checkout, or Ninja path stays as one ^. cmake.exe is unchanged.
There's a Windows test with a fake cmake.cmd/.bat that checks the arguments and exit status. It skips on Linux. If you can, please re-run your harness on this.
There was a problem hiding this comment.
The previous cmd /d /s /c ""wrapper" args" form broke once it was written into _build.cmd: the leading "" ended the quote, so a ^ in the path was unquoted. Paths now go into quoted set "VAR=..." lines and a nested cmd /d /v:on /s /c ^""!VAR!" args^" expands them, so the caret stays a single ^ and the wrapper still returns. cmake.exe is unchanged.
Windows tests all passed: 10/10 in test_build_runtime_fallback.py and 1/1 in test_build_runtime_batch.py, on PowerShell 5.1 and Python 3.14.9.
|
Tested 9e05aab on Windows 11, PowerShell 5.1, MSVC 19.44.35215.0 (toolset 14.44.35207), Vulkan SDK 1.4.363.1. No game data. PowerShell 7 is not installed here. In a checkout whose path contains The build in that directory still does not finish. Ninja links
AI-assisted (OpenBot team). |
CALL doubled ^ in wrapper arguments and could not find a .cmd/.bat whose own path contained ^. Nested cmd /c returns and keeps a single ^. cmake.exe stays quoted with no CALL.
The previous nested cmd /c ""wrapper" args" form failed inside _build.cmd: the leading "" ended the quote, so ^ in the path was unquoted. Set the paths in quoted env vars and let a nested cmd /v:on expand !VAR!. cmake.exe stays quoted with no CALL.
|
@iurysf thanks for testing. 9e05aab was the older head: since e85cf4a, |
Claimed in the coordination issue as a follow-up of #3554, from @VeTkN's finding.
What and why
scripts/build_runtime.ps1wrotecall "$cmake"into_build.cmd.cmd'sCALLdoubles^in the rest of the command, so a checkout such asC:\LT\caret^dirwas seen by CMake asC:/LT/caret^^dir/runtimeand configure failed. #3554 had already fixed the_build.cmdlaunch for&and^.cmake.exe: quoted, noCALL(Get-CmakeExeBatchBody).cmake.cmd/cmake.batfrom PATH (@SirKingg's review): noCALLeither. The paths go into quotedset "VAR=..."lines and a nestedcmd /d /v:on /s /c ^""!VAR!" args^"expands them, so a^in the wrapper, checkout or Ninja path stays a single^, and the wrapper still returns.|| exit /b 1keeps a CMake failure fatal (Get-CmakeWrapperBatchBody).Out of scope: with a
^in the checkout, the MSVC link step can still fail (LNK1181), because CMake's Ninja rule runslib.exethroughcmd.exewith unquoted object paths (@iurysf's report). This PR only fixes the configure/build launch inbuild_runtime.ps1.Testing
python -I tests/test_build_runtime_fallback.py10/10 passed,python -I tests/test_build_runtime_batch.py1/1 passed (fakecmake.exe/.cmd/.batin acaret^dirfolder; arguments and exit status checked).python -m compileall -q make_game.py tools testsOK.No GPU test was run, and no game data was used.
AI-assisted.