tests: decode startup staging diagnostics safely on Windows #2591
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2599"
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 R0Y00 on 2026-11-25T22:40:20Z.
Follow-up to #1549. On a Windows host with active ANSI code page 936, PowerShell 7 writes UTF-8 diagnostics. Python’s default text-mode capture raised
UnicodeDecodeErrorin its pipe-reader thread and the staging guard then receivedNoneinstead of stderr. Decode the PowerShell diagnostics explicitly as UTF-8 with replacement and keep the system decoding with replacement forcmd.exe’s junction diagnostic. The fixture still asserts exit status, ASCII diagnostic markers, output contents and path guards as before.At
b41f6fcathe first command below reproduced the decoder error. On81c0fda3both passed on Windows 11 build 26200 with Python 3.12 andlocale.getpreferredencoding(False) == 'cp936':The fixture uses synthetic files and keeps the missing/empty input, junction, overwrite and package-preservation checks. This changes the test harness only.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:19:06Z.
Review: COMMENTED
Review of
19dce04b(aftergh pr update-branch; the PR's own diff is unchanged from81c0fda3).Scope: test harness only,
tests/startup_stage_package_check.py(+4/-3). Both PowerShell captures and themklink /Jcapture now decode explicitly (encoding="utf-8", errors="replace"for PowerShell, system decoding witherrors="replace"forcmd.exe). All existing assertions are untouched.Checked:
text=Trueused the locale code page and raised in the reader thread, sostderrcame backNone. Explicit decoding with replacement removes that failure mode.git diff --check origin/main...HEAD: clean.python3 tests/docs_links_check.py: 19 files, 498 links ok.python3 tests/bidi_controls_check.py: ok.ctest --preset dev -R '^startup_stage_package$': 1/1 passed on19dce04b.Limits: the Win2025 host does not use code page 936, so this run does not reproduce the original decode error. That evidence is the author's
python -X utf8=0run on cp936 in the PR body. I did not mutate the test (it needs PowerShell; the Linux host has none).No blocking findings.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:19:18Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
19dce04be3a6b8619848ecac33de584c753c48d7:--preset dev):ctest --preset dev -R '^startup_stage_package$' --parallel 2 --no-tests=error --output-on-failure: 1/1 passed (5.97s).Command:
python3 x2w_pipe.py win2025 2599 --regex '^startup_stage_package$' --wait 7200AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:21:09Z.
[PASS] PR #2599@19dce04b ready-to-post snippet (NOT posted):
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
19dce04be3a6b8619848ecac33de584c753c48d7:--preset dev):cmake --build --preset dev -- -j 2):0.00s(configure0.00s)ctest --preset dev -R '^startup_stage_package$' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (6.34s:startup_stage_package6.10s)/O2(--preset release):cmake --build --preset release -- -j 2):0.00s(configure0.00s)ctest --preset release -R '^startup_stage_package$' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (6.62s:startup_stage_package6.31s)sccache: 1/7 hits; wall31.3sAI-assisted; commands listed were executed locally.