launchers: values written into PowerShell keep every single quote (LAUNCHER-SINGLE-QUOTE-ESCAPE) #3253
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3253"
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:43:43Z.
Claim: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7360857465 (LAUNCHER-SINGLE-QUOTE-ESCAPE)
Depends on: #3233 (this branch is #3233's commit plus one; the edited lines are next to its line 742)
What and why
PowerShell reads U+2018, U+2019, U+201A and U+201B as single quotes, not only
'. Two launchers write PowerShell source text and quoted it with-replace "'", "''", which doubles only the ASCII apostrophe:d3d12/scripts/play-nvidia.ps1buildsLEONIDA_MENU_ARGS, the command the F1 menu's SAVE AND RESTART runs throughpowershell -Command(host/menu.rsrestart()). A folder named with a typographic apostrophe ended the string early: the restart did not parse. Reproduced in Windows PowerShell 5.1.scripts/game-gate.ps1writeslaunch.ps1. Besides the-Morevalues, it pasted$repo,$play,$Gameand$Datainto quotes with no escaping at all, so a repository underC:\Bob's\already broke it. It also wrote the file withSet-Content, which on Windows PowerShell uses the ANSI code page (U+201B became?), whilepwsh, which runslaunch.ps1, reads a file with no BOM as UTF-8.What changed
[Management.Automation.Language.CodeGeneration]::EscapeSingleQuotedStringContent(a one-lineConvertTo-Quoted; the repository has no shared PowerShell module).game-gate.ps1quotes the four folders the same way and writeslaunch.ps1as UTF-8 with a BOM, which both PowerShells read.$PlayArgsstays raw on purpose: it is argument text, pasted the same way as inTest-NoDlssBound.tests/test_launcher_quoting.py:LEONIDA_MENU_ARGSto a stub script, as the runtime does, and checks-Exe,-PcGlyphsand-MenuRestartarrive intact;launch.ps1block alone with folders and a value holding all five quotes, parses the file it writes, and checks there are no errors and that the quoted strings are the values given.Verification (Windows 11, Windows PowerShell 5.1, Python 3.11; no game files, no GPU needed)
.ps1changes reverted, both tests fail. The restart gets the path cut at the first typographic quote, andlaunch.ps1has a parse error. With the change, both pass.tests/test_win_launchers.py,tests/test_play_nvidia_menu_choice.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.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 checked that
EscapeSingleQuotedStringContentdoubles all five quotes in 5.1, that$PlayArgsis meant to stay raw, that nothing else readslaunch.ps1, and the encodings. It found nothing blocking; I applied its suggestion to keep the test's own temporary paths out of quotes.Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T22:48:33Z.
Review: COMMENTED
Reviewed
51bb0da2. In a sandbox I ran both new path round-trip tests with Linux PowerShell 7.7.0 after enabling the Windows-gated class in the disposable test copy. Both passed: a synthetic executable and glyph folder survive F1 restart, and the gate’s generated launch script parses back to the original folder strings. The launcher suite also passed its five runnable tests with five Windows-only skips.The current #3233 head (
86e92f66) is an actual ancestor of this PR, and its tree matches the previous #3233 head9f84a449. #3240 at3de2d360merges cleanly with this PR. With #3247 at3e5887f6, the launcher script merges cleanly and the inherited conflict is intests/test_win_launchers.py, where both branches add tests at the same spot.Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T00:08:24Z.
VERIFY-3253 — Windows nativo:
red then greenen las comillas del script de arranque51bb0da2d—play-nvidia.ps1,game-gate.ps1,tests/test_launcher_quoting.py(+122),tests/test_win_launchers.py(+46)Ran at the head
Negative control: I put
main'sscripts/game-gate.ps1andd3d12/scripts/play-nvidia.ps1back, kept the tests and re-ran:It bites in three places, and the third one is the important one: the same bug reaches a launcher that was not touched by this pull request (
test_win_launchers.py), because the quoting rule is shared — which is exactly why a fix in one script and a fix in the other have to land together.What the change is: a value written into PowerShell keeps every single quote —
'is the quoting character in this language, and a path or a switch value containing one closes the string early:'the folder's name'. The tests do not check the text, they check the round trip — "reads back every value" and "hands back every quote" — which is the only assertion that survives a different quoting strategy.What I could not test
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T01:32:38Z.
The stack is rebased, both branches are on the fork, and they merge in order
After
#3247landed, this pull request could not merge — it is stacked on#3233and the same file conflicted. Both halves are now rebased and verified:pr-3233-rebasedfcaed1015maind5b30be1c#3233's-PcGlyphsreplay, plus#3247's test keptpr-3253-rebased185575f27fcaed101551bb0da2d, aloneVerified on
185575f27(this machine, no conflicts during the rebase at all):185575f27is one commit on top offcaed1015—51bb0da2dalone, three files, +137/−6 — and it rebased with no conflict because the file resolution#3233needed was already made. That is the stack working as a stack should: the second half is trivial once the first is done.Authors are unchanged (
Luiz Nevesfor#3233, yours here), so these can be pushed to the original branches or merged from the fork — whichever the maintainer prefers.And the order is not a preference:
#3253cannot go first (git merge-base --is-ancestor pr/3233 pr/3253says yes), so the two land together or the second one waits.The same two branches also leave
tests/test_win_launchers.pyconsistent for#3104: it conflicts inplay-nvidia.ps1only — one hunk, its own rebase.Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T02:03:13Z.
Re-stacked on the new base:
5798bac1e, one commit on3c2a1c728, and it rebased with no conflict at allAfter
#3182movedtests/test_win_launchers.py, both halves of this stack had to move. The lower one is now3c2a1c728ond15e048a7, and this one is one commit on top of it:No conflict this time, and that is the point of the stack: the contested file was resolved once, in
#3233's rebase, and this pull request's own commit —51bb0da2d, the quoting fix — applies on top of it without touching that resolution.So the branch is:
https://github.com/fiestorra/leonida-carry/pull/new/pr-3253-rebased, head5798bac1e, author unchanged (Luiz Neves), and it is one commit on top of#3233's rebase.The order is not a preference and never was:
#3253carries#3233(git merge-base --is-ancestor: yes), so it cannot go first — but once#3233merges, this one is a single commit and its own tests are two files.Two branches, two rebases, and the second was free — which is what a stack is for, and what the four of these cost nobody when they are merged in order.
Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-03T02:11:11Z.
Rebased with its stack: this PR is now one commit,
bddb2e52e, on #3233's5418b7fac(onmaind15e048a7). The rebase applied with no conflict.tests/test_launcher_quoting.py(2),tests/test_win_launchers.py(12),tests/test_play_nvidia_menu_choice.pyandtests/test_game_gate.pypass. With both.ps1files put back from the commit below, the two quoting tests fail. Thanks @fiestorra and @merzleckeier.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T07:01:45Z.
This pull request has a merge conflict with current
main(d9b618f10), so it can't be run in game or merged as it is. Could you merge the latestmaininto it (or rebase onto it) and resolve the conflict? Once the head is updated, the in-game gate run can be done on the new head.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-03T11:52:01Z.
@MoonEyes rebased with its stack: this PR is one commit,
499088156, on #3233's5fcc7ab9c(onmainb053a1813). The rebase applied with no conflict.tests/test_launcher_quoting.py(2),tests/test_win_launchers.py(13),tests/test_play_nvidia_menu_choice.pyandtests/test_game_gate.pypass. With both.ps1files put back from the commit below, the two quoting tests fail. Clean-room check: exit 0.Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T12:08:14Z.
Rechecked the rebased stack on
b053a181with #32335fcc7ab9, #325349908815, and #3258d59f87a9. Under PowerShell 7.6.6 on Linux, the generatedlaunch.ps1started a synthetic launcher through the gate’s-Fileargument. Paths with spaces, ASCII apostrophes and all four typographic single quotes, the settings value, and the stub’s exit code all survived. I also ran #3253’s actualLEONIDA_MENU_ARGSthrough the Rustrestart_processfrom #33035942d059. The restarted stub received the exact script, executable and-PcGlyphspaths. The two quoting tests passed with their platform guard adapted for Linux.One existing follow-up in the generated
launch.ps1.Set-Locationstill treats brackets in the checkout path as a wildcard. With synthetic sibling folderscheckout [a]andcheckout a, the stub ran fromcheckout aon bothmainand the stack.Set-Location -LiteralPathpreserved the intended working directory in the same fixture.AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-03T13:11:57Z.
Independent native Windows launcher compatibility verification — stock 300 s gate PASS, and exact emitted restart dry replay PASS (no interactive F1 restart).
Tested #3253 head
499088156977db9771b6aefbd0a37de650700b6bstacked on #32335fcc7ab9cf7cd671019b5b5e84171d46323b82f4, current mainb053a1813c8980c4357d51bbe6e69a35dc8c476c, clean local mergecd7cddbaa398b915d81c20806ed406b3bda55128. The staged diagnostics,dlss,mimalloc executable SHA-2560991cd2699da81a9944cbf84742a90389929fbe550a94368327a632102470b8cwas built for #3235 on the same base; comparing the entire trees found differences only in the two launcher scripts and test files, so this is a runtime-equivalent binary, not a new exact-source build. Windows 11 Home 26200, RTX 3090 24 GB driver 610.88, Ryzen 9 5900X, 32 GB RAM.AI-assisted: GPT-6.2 Sol. Independent parent recomputation verified the runtime statistics and test counts. No game content or private paths attached.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T15:26:53Z.
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 head499088156. 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.