startup: keep a character split between two log reads in the live view #1571

Manually merged
github merged 1 commit from gh-pr/1571/head into gh-pr/1571/base 2026-11-26 23:17:39 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-24 14:25 UTC · original
tedin7:x2w-frontier-w6-liveview → main · +93 −6 · 3 files · 1 commits · merged 2026-11-24 16:11 UTC

The live view opened the logs in text mode and kept the offset from tell(). A read that ended inside a UTF-8 character turned the partial bytes into a replacement character and skipped past them, so a non-ASCII path (for example G:\café.bin written in two pieces) showed two replacement characters. The logs are now read as bytes, the unfinished line stays as bytes, whole lines are decoded, and sys.stdout is reconfigured for UTF-8 with replacement so redirected output on Windows does not corrupt non-ASCII paths or raise UnicodeEncodeError on replacement characters.

New check: tests/startup_live_view_check.py covers:

  • a multi-byte UTF-8 path split across two reads (both LF and CRLF line ends),
  • a CRLF line end split across two reads (\r at the end of the first read, \n at the start of the second),
  • genuinely invalid UTF-8 bytes replaced with U+FFFD without stalling subsequent lines, and
  • an ASCII split control.

It fails on origin/main (shows two replacement characters) and passes here on Linux and Windows Server 2025.

CMakeLists.txt is touched: one add_test (startup_live_view) next to startup_inflate. The overlay window files and #1537 are untouched.

Commands executed locally: python3 -B tests/startup_live_view_check.py (default and LC_ALL=C); python3 -m py_compile; python3 -B tests/docs_links_check.py; python3 -B tests/bidi_controls_check.py; git diff --check; Windows Server 2025 tests/startup_live_view_check.py and CTest startup_live_view.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 14:25 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1571) `tedin7:x2w-frontier-w6-liveview` → `main` · +93 −6 · 3 files · 1 commits · merged 2026-11-24 16:11 UTC The live view opened the logs in text mode and kept the offset from tell(). A read that ended inside a UTF-8 character turned the partial bytes into a replacement character and skipped past them, so a non-ASCII path (for example `G:\café.bin` written in two pieces) showed two replacement characters. The logs are now read as bytes, the unfinished line stays as bytes, whole lines are decoded, and `sys.stdout` is reconfigured for UTF-8 with replacement so redirected output on Windows does not corrupt non-ASCII paths or raise `UnicodeEncodeError` on replacement characters. New check: `tests/startup_live_view_check.py` covers: - a multi-byte UTF-8 path split across two reads (both LF and CRLF line ends), - a CRLF line end split across two reads (`\r` at the end of the first read, `\n` at the start of the second), - genuinely invalid UTF-8 bytes replaced with U+FFFD without stalling subsequent lines, and - an ASCII split control. It fails on `origin/main` (shows two replacement characters) and passes here on Linux and Windows Server 2025. `CMakeLists.txt` is touched: one `add_test` (`startup_live_view`) next to `startup_inflate`. The overlay window files and #1537 are untouched. Commands executed locally: `python3 -B tests/startup_live_view_check.py` (default and `LC_ALL=C`); `python3 -m py_compile`; `python3 -B tests/docs_links_check.py`; `python3 -B tests/bidi_controls_check.py`; `git diff --check`; Windows Server 2025 `tests/startup_live_view_check.py` and CTest `startup_live_view`. AI-assisted; commands listed were executed locally.
The live view opened the logs in text mode and kept the file offset from
tell(). A read that ended inside a UTF-8 character decoded the partial bytes
as a replacement character and moved past them, so the rest of the character
was replaced as well and a non-ASCII path was shown as two replacement
characters. Read the logs as bytes, keep the unfinished line as bytes, decode
whole lines, and configure stdout for UTF-8 with replacement so redirected
pipes on Windows do not mangle or fail on non-ASCII and replacement output.

AI-assisted; commands listed were executed locally.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:17:37 +00:00
github manually merged commit aec7d276e8 into gh-pr/1571/base 2026-11-26 23:17:39 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 14:38 UTC · original · edited 2026-11-24 14:41 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T14:41:28.931812Z aec7d27 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 14:38 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1571#issuecomment-7134700447) · edited 2026-11-24 14:41 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"aec7d276e8f542254b711351666755a0aaaf1b27","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T14:41:28.931812Z">2026-11-24T14:41:28.931812Z</relative-time> | `aec7d27` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
This discussion has been locked. Commenting is limited to contributors.
No description provided.