Scripts: smoke.ps1 leaves XCL_NETWORK=0 in the caller's session, and a -Game path ending in a backslash breaks the run #2259
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#2259
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@itsonewi on GitHub · 2026-11-25 11:42 UTC · original
Summary
Two small defects in the run block of
scripts/smoke.ps1(426a5a7). Neither changes the numbers in the block; both change what the machine does around it.1.
XCL_NETWORK=0is left set in the caller's sessionThree variables are set, two are removed. A script runs in the caller's process, so
XCL_NETWORK=0stays in the PowerShell session after.\scripts\smoke.ps1returns, and everything started from that window afterwards inherits it:xcl runin the same session is silently offline, which is easy to misread as a title or network bug;XCL_NETWORK=0still connects, still binds UDP 3074" reports (#444, #568) in that window gets a misleading result whichever way it goes;scripts/test-smoke-artifacts.tests.ps1runssmoke.ps1twice in the runner's session;XCL_NETWORKset to something else, the script overwrites it and never puts it back.The same three variables also survive any
throwbefore theRemove-Itemline -XCL printed no log pathis one - because nothing restores them on the way out. Atry/finallyaround the run covers both cases: save the three values first, restore them in the block.2. A
-Gamepath ending in a backslash breaks the command lineProcessStartInfo.Argumentsis one command-line string, so Windows parses it by its usual rules: a backslash directly before a quote does not escape anything, it makes that quote literal. So-Game 'D:\Games\Foo\'produces the command linerun "D:\Games\Foo\", and XCL receivesD:\Games\Foo"with no closing quote - a path error that says nothing about the real cause. Thecmd.exebranch (/c ""<xcl>" run "<game>"") has the same hole.This is not a hypothetical input shape:
scripts/smoke-title.tests.ps1already passesD:\Games\<name>\with a trailing separator in itsforeach ($game in @(...))loop, but it asserts only thetitle:hash, so the command line built from that value is never exercised - the fixture is a.cmdthat ignores its arguments.Suggested fix
before the block that builds
$psi, plus the save/restore above. Trimming the separator does not change thetitle:line, which hashes(Split-Path $Game -Leaf).Trim().Not reported elsewhere
Searched open and closed issues for
smoke.ps1,XCL_NETWORK,trailing backslashandcommand line escaping: nothing covers either point. #717 and #1855 are about what the block says; #1506 and #2213 are about how it is compared.Not tested
426a5a7without a checkout, and both points are visible in the source. The-Gamefix should be checked under bothpowershell.exeandpwsh.exe, since 5.1 and 7 pass the same string toCreateProcess.AI use
scripts/smoke.ps1,scripts/smoke-title.tests.ps1andscripts/test-smoke-artifacts.tests.ps1on426a5a7, wrote this report and the two fixes; the human account checked each claim against the files before opening it.@upipibi on GitHub · 2026-11-25 11:57 UTC · original
@itsonewi Both of these already have open PRs, in case that saves a third one:
XCL_NETWORK=0left set: #521 (wileyGray,9bb6aa2, mergeable). It savesXCL_NETWORK,XCL_RUN_SECONDSandXCL_ACTIVITYbeforeStart()and restores all three in afinally, so the caller's values come back, unset ones included.-Gameending in a backslash: #588 (luna020924,1707802). It doubles the trailing backslashes before the closing quote ($Game -replace '\+\z', '$0$0'). It conflicts withmainnow, so it needs a rebase.I only read the two diffs against
main1a0bbe3a; I didn't run them.AI-assisted (Claude Code).
@itsonewi on GitHub · 2026-11-25 12:00 UTC · original
Thanks @upipibi - you are right, and both are open: I checked the two diffs against
1a0bbe3aand they cover the two halves of this report.XCL_NETWORK,XCL_RUN_SECONDSandXCL_ACTIVITYin afinallyaroundProcess.Start, which is what point 1 needs (and it goes further than the report: the caller's original values come back, absent ones included, and a failed launch is covered too).main, so it needs the rebase.How I missed them: my duplicate search used
is:issue, which drops pull requests from the results, so both PRs were invisible to it. That is my mistake, not a judgement call.Closing this as a duplicate. The only thing worth keeping from it is the two fixes in one place: whoever lands first, the other's file and test do not overlap, so both can merge.