launchers: command-line arguments keep a folder's last backslash (GAME-GATE-START-QUOTING) #3257
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!3257
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/game-gate-start-quoting"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claim: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7361113895 (GAME-GATE-START-QUOTING)
What and why
Two launchers build a Windows command line by quoting each argument as
'"' + ($s -replace '"', '\"') + '"'. Windows reads a command line back byCommandLineToArgvW's rules, where a backslash in front of a quote escapes that quote. So:scripts/game-gate.ps1:103, thestartverb (the detached supervisor, made throughWin32_ProcessCreate):-RunRoot D:\runs\became"D:\runs\", which reads asD:\runs"plus every argument after it. The same happened to-Moreor-PlayArgstext holding a backslash before a quote.d3d12/scripts/play-nvidia.ps1:808, the button-prompt tool's arguments: a-PcGlyphsfolder such asC:\My glyphs\swallowed its closing quote in the same way.What changed
"are doubled, plus one for the quote, and the backslashes before the closing quote are doubled.\zis used, not$, so a value ending in a newline is not mistaken for one ending in backslashes.play-nvidia.ps1also quotes an empty argument as""so it is not dropped. The tool's arguments are never empty today, but the rule is now complete.tests/test_game_gate_start_quoting.pyruns each script's own quoting line on awkward values: a trailing backslash, two trailing backslashes, embedded quotes, a backslash before an embedded quote, spaces, and an empty value. It parses the joined line back withCommandLineToArgvWitself (ctypes) and checks every value comes back as one argument.Verification (Windows 11, Windows PowerShell 5.1, Python 3.11; no game files, no GPU needed)
.ps1changes reverted, both tests fail.D:\runs\comes back asD:\runs" -Arg C:\Program, and the following arguments merge. With the change, both pass.tests/test_win_launchers.pyandtests/test_game_gate.pystill pass.python -I scripts/check_no_game_data.pyon the three files: exit 0. Both.ps1stay CRLF and ASCII; the test is LF and ASCII.play-nvidia.ps1:808is far from the lines #3233, #3240 and #3253 touch; it merges with them in any order.AI assistance
AI-assisted: written with Claude Code (Claude Opus 5.5). It was reviewed by a separate read-only reviewer agent (Claude Opus 5.5), which confirmed the rule is the standard argv-quoting algorithm, that pwsh's argument parsing agrees with
CommandLineToArgvWhere, and that no other call site inscripts/,d3d12/scripts/ortools/uses this naive quoting. It found nothing blocking. Following its notes, I switched to\z, extended the fix toplay-nvidia.ps1:808, and hardened the test's ctypes calls.VERIFY-3257 — Windows nativo:
red then greenen la barra final de una carpeta47688d9d7—play-nvidia.ps1(6),game-gate.ps1(4),tests/test_game_gate_start_quoting.py(+94)Ran at the head
Negative control:
main's two scripts back, tests kept:It bites.
What the change is: a command-line argument keeps the last backslash of a folder —
C:\Games\passed to a child loses its trailing\, or worse, the\"sequence turns the backslash into an escape and eats the quote. Both halves are the classic quoting trap on Windows, and the test asserts "each value back as one argument", which is the property — not the characters.Why this one, #3253 and #3258 are one family and should be read together: all three are "a value that the launcher passes to a child and the child does not get back" — a path with a space, a value with a quote, a folder with a trailing separator. None of them is visible in a normal run, which is why they survived until someone's folder had a space in it.
What I could not test
Written with an AI assistant.
Windows native verification (
red -> green) -- PASS on head3bc1c333e(merged cleanly viagit merge --no-ffontomaind9b618f10).Checks (Windows 10 x64, Python 3.12, PowerShell 5.1)
python -I scripts/check_no_game_data.py-> PASSpython -I tests/test_game_gate_start_quoting.py -v-> Ran 2 tests in 0.447s / OKd3d12/scripts/play-nvidia.ps1,scripts/game-gate.ps1tomaind9b618f10, keeping the PR's tests):tests/test_game_gate_start_quoting.py-> Ran 2 tests in 0.439s / FAILED (failures=2) (exit1)AI-assisted: yes (Antigravity -- Gemini 4 Neon).
In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #3220, #3240, #3253 and #3257 merged into main
b053a1813; this PR tested at its current head3bc1c333e. Series S 1080, DLSS FG 2x, launched throughplay-nvidia.ps1with-SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed, scripted walk, 330 s.AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.