startup: read the literal data directory manifest #2862

Merged
louisdibiasi merged 1 commit from upstream-pr/2870 into main 2026-11-27 08:02:00 +00:00
louisdibiasi commented 2026-11-26 15:10:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by louisdibiasi on 2026-11-26T15:10:38Z.


Change

When -DataDir contains wildcard characters, run.ps1 treats its MicrosoftGame.config path as a pattern. A synthetic directory named data [test] caused both PowerShell 5.1 and 7 to read the manifest in the sibling data t directory. The resulting title ID and storage quota are passed to the runtime from the wrong manifest. If the intended manifest is absent, the sibling was still read.

Use literal paths for both the existence check and the manifest read. This fixes the manifest lookup only; bracketed launcher workspace and log paths are separate limitations. #2867, #2820 and #2822 also touch this launcher or its test, so the later merge may need to reconcile those changes.

Verification

Windows, base b505c32b, head 682a6034:

  • out\pe-env\Scripts\python.exe -B tests\startup_run_ps1_check.py — passed on Windows PowerShell 5.1 and PowerShell 7. Before the fix the new bracketed and missing-manifest cases failed on both shells, selecting the sibling's 9999 / 99 instead of the intended 1234 / 42 or no values. The ordinary path is a positive control.
  • Independently reverting either literal-path change made its matching new control fail under each shell.
  • out\pe-env\Scripts\python.exe -B tests\startup_run_ps1_check.py --text-only — passed.
  • out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py — passed.
  • . .\tools\dev.ps1; cmake --build --preset pr; ctest --preset pr --no-tests=error — build passed; 36 passed and four min-LOD WARP tests skipped. dev.ps1 reported vswhere.exe unavailable on PATH; the configured build completed.
  • git diff --check — passed.

Evidence and follow-up

The regression creates both manifests and the debugger stub in a temporary source-built fixture; no title data is used. Runtime consumers of these environment values are in src/startup_stubs/runtime_proxy.cpp. This does not establish title startup or hardware behavior.

AI-assisted.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed (not applicable).
  • I did not include game files, dumps, distribution links or secrets.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5512524251 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2870). Originally posted by [louisdibiasi](https://github.com/louisdibiasi) on 2026-11-26T15:10:38Z. --- ## Change When `-DataDir` contains wildcard characters, `run.ps1` treats its `MicrosoftGame.config` path as a pattern. A synthetic directory named `data [test]` caused both PowerShell 5.1 and 7 to read the manifest in the sibling `data t` directory. The resulting title ID and storage quota are passed to the runtime from the wrong manifest. If the intended manifest is absent, the sibling was still read. Use literal paths for both the existence check and the manifest read. This fixes the manifest lookup only; bracketed launcher workspace and log paths are separate limitations. #2867, #2820 and #2822 also touch this launcher or its test, so the later merge may need to reconcile those changes. ## Verification Windows, base `b505c32b`, head `682a6034`: - `out\pe-env\Scripts\python.exe -B tests\startup_run_ps1_check.py` — passed on Windows PowerShell 5.1 and PowerShell 7. Before the fix the new bracketed and missing-manifest cases failed on both shells, selecting the sibling's `9999` / `99` instead of the intended `1234` / `42` or no values. The ordinary path is a positive control. - Independently reverting either literal-path change made its matching new control fail under each shell. - `out\pe-env\Scripts\python.exe -B tests\startup_run_ps1_check.py --text-only` — passed. - `out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py` — passed. - `. .\tools\dev.ps1; cmake --build --preset pr; ctest --preset pr --no-tests=error` — build passed; 36 passed and four min-LOD WARP tests skipped. `dev.ps1` reported `vswhere.exe` unavailable on PATH; the configured build completed. - `git diff --check` — passed. ## Evidence and follow-up The regression creates both manifests and the debugger stub in a temporary source-built fixture; no title data is used. Runtime consumers of these environment values are in `src/startup_stubs/runtime_proxy.cpp`. This does not establish title startup or hardware behavior. AI-assisted. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed (not applicable). - [x] I did not include game files, dumps, distribution links or secrets.
KelboLive commented 2026-11-26 20:56:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-26T20:56:13Z.

Review: COMMENTED


Using -LiteralPath instead of -Path fixes the bracket-matching pitfall in PowerShell where [ and ] are glob characters. This prevents manifest parsing from silently failing (or worse, matching the wrong directory) when the data path contains special characters.

The test harness mirrors this scenario well: a bracketed data directory, a decoy directory (data t), and a manifest="bracket_missing" case to confirm the fix doesn't break when the config is absent.

One small note: the decoy directory data t only exists for manifest.startswith("bracket"), so in the bracket_missing case it won't be created. Consider whether bracket_missing should still create the decoy to ensure we don't accidentally pick up a config from the wrong path — though since the test expects manifest in ("normal", "bracket") for a populated manifest, this edge is already covered.

No other concerns for this change.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6080397840 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2870#pullrequestreview-6080397840). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-26T20:56:13Z. **Review:** COMMENTED --- Using `-LiteralPath` instead of `-Path` fixes the bracket-matching pitfall in PowerShell where `[` and `]` are glob characters. This prevents manifest parsing from silently failing (or worse, matching the wrong directory) when the data path contains special characters. The test harness mirrors this scenario well: a bracketed data directory, a decoy directory (`data t`), and a `manifest="bracket_missing"` case to confirm the fix doesn't break when the config is absent. One small note: the decoy directory `data t` only exists for `manifest.startswith("bracket")`, so in the `bracket_missing` case it won't be created. Consider whether `bracket_missing` should still create the decoy to ensure we don't accidentally pick up a config from the wrong path — though since the test expects `manifest in ("normal", "bracket")` for a populated manifest, this edge is already covered. No other concerns for this change.
R0Y00 commented 2026-11-27 08:01:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T08:01:21Z.

Review: APPROVED


Reviewed 682a6034 against main 22107932. The launcher uses literal paths for both the existence check and the read. This prevents the manifest from a sibling matching the bracket pattern from supplying the runtime's title ID or storage quota.

python -B tests/startup_run_ps1_check.py passed with Windows PowerShell 5.1 and PowerShell 7, and the text-only check passed. In each shell I also ran the ordinary, bracketed and absent-manifest cases independently. Reverting Test-Path -LiteralPath failed the absent-manifest control. Reverting Get-Content -LiteralPath failed the bracketed-manifest control. These were source-built launcher stubs. Hosted Windows, Linux Python and gfx1013 checks passed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6085101821 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2870#pullrequestreview-6085101821). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T08:01:21Z. **Review:** APPROVED --- Reviewed `682a6034` against `main` `22107932`. The launcher uses literal paths for both the existence check and the read. This prevents the manifest from a sibling matching the bracket pattern from supplying the runtime's title ID or storage quota. `python -B tests/startup_run_ps1_check.py` passed with Windows PowerShell 5.1 and PowerShell 7, and the text-only check passed. In each shell I also ran the ordinary, bracketed and absent-manifest cases independently. Reverting `Test-Path -LiteralPath` failed the absent-manifest control. Reverting `Get-Content -LiteralPath` failed the bracketed-manifest control. These were source-built launcher stubs. Hosted Windows, Linux Python and gfx1013 checks passed.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2862
No description provided.