tooling: stage an isolated startup executable directory #1542
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1549"
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 R0Y00/Xbox2Windows. Originally posted by SuperCraft3M on 2026-11-24T13:48:46Z.
Change
Stage one executable and its adjacent DLLs in a fresh startup directory. Archives and subdirectories stay at the data root used by
run.ps1 -DataDir. The command refuses occupied and overlapping destinations and paths through junctions or other reparse points.The rebased change resolves relative
-RunDirfrom the current PowerShell location and copies files with the exact.dllextension.Verification
Head
3fa4bde3on18f2f85c, Windows 11 build 26300.9711.ctest --preset release --no-tests=error -R '^startup_stage_package$' -Vpassed under Windows PowerShell 5.1.python -B tests/startup_stage_package_check.py pwshpassed under PowerShell 7.git diff --check upstream/main...HEADpassed.The synthetic inputs cover staging after
Set-Location, exact DLL extensions, DLLs alongside a nested executable, package preservation, a sibling destination, and refusal of an occupied destination, a junction, an overlapping path and an executable outside the package.AI-assisted (Codex).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T15:51:16Z.
Review: COMMENTED
Technical review (static reading only: this host has no PowerShell, so neither
stage_package.ps1norstartup_stage_packagecould be run, and no mutation check was possible on the script. Everything below is from reading the diff against documented .NET and PowerShell behaviour; please treat the two behavioural points as "to confirm on Windows".)Checked out the PR head in a clean tree.
What I could check:
tests/startup_stage_package_check.pyis plain Python aroundsubprocess.run; its expectations match the strings in the script ("absent or empty", "separate from PackageDir", "executable file").Test-PathInsideappends\beforeStartsWith, sopackage-runis not treated as insidepackage, andTest-PathInside $package $runrejects a run directory that is a parent of the package. The.TrimEnd('\')on a drive root such asC:\leavesC:, which still works with the prefix test but is worth knowing.REFERENCE_POWERSHELL ... REQUIREDprecedent, inside the sameINTAKE_PYTHONblock.docs/startup-runtime.mdtext and thedocs/experiments.mdsection agree with the script's behaviour (archives and subdirectories not copied, empty or absent destination, reparse points refused).Points to confirm on Windows:
$run = [IO.Path]::GetFullPath($RunDir)resolves a relativeRunDiragainst the process's current directory, which PowerShell does not update when you runSet-Location. In an interactive session that didcdafter start,-RunDir out\run1can be staged under the directory the process started in, not the current location, and every later check passes because it works on that absolute path. The test only passes absolute temp paths, so it cannot see this.$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($RunDir)resolves it the PowerShell way (the script already usesResolve-Pathfor the other two inputs).Get-ChildItem -Filter '*.dll'goes through the Win32 wildcard matcher, which also matches longer extensions that begin withdll(the documented three-character-extension behaviour, like*.xlsreturning.xlsx). A file such asname.dll_orname.dlloldnext to the executable would be copied and counted as a DLL. Filtering the result withWhere-Object { $_.Extension -ieq '.dll' }removes that.Untested guards (the script has them, the check does not exercise them): a run directory that is a sibling with the package name as prefix (
package-run), an executable outsidePackageDir, a destination that is an existing file, a destination under a reparse point (the docs list this refusal), a relativeExein a subdirectory (its DLLs come from that subdirectory, not the package root), and relativeRunDirpaths. The reparse-point guard in particular needs a junction created in the test (New-Item -ItemType Junction) to be pinned.Smaller observation: the second operand of the "inside PackageDir" test (
$source.Equals($package)) cannot be true, since$sourceis a file; harmless.No other defects found in the diff.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:53:53Z.
@SuperCraft3M could you rebase this branch onto current
mainand force-push?GitHub reports head
de63659bas conflicting withmain, so it cannot be merged as is.Files that conflict with current
main(cf97bee1):CMakeLists.txtdocs/experiments.mdCommands run locally:
Once it is rebased and CI is green it will be re-checked right away.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:50:53Z.
Review: COMMENTED
Review of head
3fa4bde3(comment only).Checked:
tools/startup/stage_package.ps1: Exe must be inside PackageDir and a.exefile. RunDir must be separate from the package and its parents. It refuses a RunDir that passes through a reparse point, or that is not absent/empty. Only the exe and exact.dllfiles beside it are copied (no recursion, no archives).tests/startup_stage_package_check.pycovers each guard with a negative control: occupied destination, package overlap, parent of package, non-exe, exe outside the package, junction, changed PowerShell location,.dll_/.dlloldnot copied, package bytes unchanged.CMakeLists.txt: the test is registered next to the other startup tests;REQUIREDon the PowerShell lookup matches the existingREFERENCE_POWERSHELLprecedent (Windows-only build).docs/startup-runtime.mdanddocs/experiments.mdupdated, links check passes.Commands run locally (Linux worktree at the exact head):
python3 tests/docs_links_check.py: ok (19 files, 488 links)python3 tests/bidi_controls_check.py: okgit diff --check origin/main...HEAD: cleancmd.exe, so it is not runnable on Linux. I did not run a code mutation locally; the run is on Windows (receipt in the next comment).No blocking findings.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:50:54Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
3fa4bde31128f97d7ffc42f7465c454faf7874d6:--preset dev):cmake --build --preset dev -- -j 2):541.97s(configure4.20s)ctest --preset dev -R '^startup_stage_package$' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (4.43s:startup_stage_package4.26s)/O2(--preset release):cmake --build --preset release -- -j 2):169.54s(configure2.37s)ctest --preset release -R '^startup_stage_package$' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (5.93s:startup_stage_package5.71s)AI-assisted; commands listed were executed locally.