launchers: command-line arguments keep a folder's last backslash (GAME-GATE-START-QUOTING) #3257
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3257"
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?
Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-02T22:50:09Z.
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.Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T22:53:15Z.
Review: COMMENTED
Reviewed
47688d9d. I ran both exact quoting expressions with Linux PowerShell 7.7.0. On Wine 11.22, seven synthetic values for each expression round-tripped throughCommandLineToArgvWand reached a spawned Windows Python process as the original argv. The fixture includes paths with spaces and one or two trailing backslashes, an empty argument, and a value with a newline. This covers argument serialization and process parsing, with no Wine game launch or supervisor run.I also checked clean merges with #3233 at
86e92f66, #3240 at3de2d360, and #3253 at51bb0da2.Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T00:08:28Z.
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.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T06:31:31Z.
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).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T15:26:55Z.
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.