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

Merged
tedin7 merged 1 commit from upstream-pr/1571 into main 2026-11-24 16:11:09 +00:00
tedin7 commented 2026-11-24 14:25:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T14:25:31Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6583997431 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1571). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T14:25:31Z. --- 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.
chatgpt-codex-connector[bot commented 2026-11-24 15:02:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T14:38:13Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134700447 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1571#issuecomment-7134700447). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T14:38:13Z. --- <!-- 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>
upstream-sync closed this pull request 2026-11-24 17:01:36 +00:00
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!1564
No description provided.