fix(relinker): escape ASCII controls in progress filenames #12495

Merged
StoneDC merged 2 commits from upstream-pr/12495 into main 2026-11-02 13:38:15 +00:00
StoneDC commented 2026-10-28 15:54:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by StoneDC on 2026-10-28T15:54:44Z.


What

Escapes ASCII control bytes 0x00..0x1F and 0x7F in progress basenames as literal \xNN, including when calculating display width; UTF-8 text is retained. Main integration now registers both console_progress and main's guest_load_ranges test targets. The production header and progress fixture are byte-identical to the preceding published head.

Tested

Windows/MinGW GCC 15.2 and Linux GCC 15.2: fresh relinker-only configure, production relinker build and both actual registered CTests console_progress + guest_load_ranges pass, zero skips. A separate build of the unchanged fixture against the real production header with only control escaping disabled fails the intended "Executable name was not escaped literally" assertion. The compile baseline passes; no compile/loader/setup failure is counted.

Published head dacbfbd9943fd8241167c4f05aa96ef510f8b8a9 integrates recorded main dc9dc7eaaeaf99b1c491d426e68bb999def3da16. Whitespace, per-head conventions with this full template, main ancestry, focused test registration and the 234-script registration audit pass. No assertion or timeout was weakened. These are focused relinker/tool checks; no full product, PS5/title, GPU or local macOS run is claimed. Fresh hosted checks remain pending until they complete.

Earlier implementation basis and validation (historical revisions)

What

ASCII control bytes in an input basename can inject terminal controls into progress output and distort its width accounting. Escape bytes 0–31 and 127 as literal \xHH in displayed basenames, using the escaped display for both messages and width. Preserve the underlying path, UTF-8 bytes and throttling behavior.

Known limits: Only ASCII control bytes in displayed filenames are escaped. General Message text and Unicode terminal column counting are unchanged. No all-Unicode terminal-safety guarantee is claimed.

Independent change based on main f3eb573e6fc3. Actual three-way merge of this exact head into the pre-publication main f8f5b24b77ad is clean. The overlap tool reports CMake insertion conflicts with #7173/#7531 and incomplete old-PR comparisons with #5021/#6713/#9793/#10861. Manual scoped diffs show separate ADX, process-parameter, Windows-path or code-scanning registrations, not this console feature. Keep both independent registration blocks; no dependency on those implementations or whole-peer build is claimed. Shared-file comparisons are scoped compatibility checks, not whole external-PR builds.

Tested

Windows 11 (MinGW GCC 15.2, Python 3.14.3, Node 24) and Ubuntu 26.04/WSL (GCC 15.2, Python 3.14.4, Node 22): windows: 1 focused CTest groups, 0 failures, 0 skipped; linux: 1 focused CTest groups, 0 failures, 0 skipped.

Built the native relinker and console_progress_tests on both hosts. The actual console unit also passed Linux ASan+UBSan; the new assertion fails against the old header on both hosts.

Commands (configure a Release Ninja build with -DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON; native targets are built where affected):

ctest --test-dir build -R '^console_progress$' --parallel 8 -V
python3 tools/check_test_registration.py --scripts

Additional integration check: all 19 independent changes combined with main 17f8dfad513b at bbba7fc479a7 passed the affected Windows/WSL suites, native relinker build, registration and environment audit. The later observed main changes only an unrelated guest test; each exact PR head also merges cleanly into it. This combined check establishes composition, not a dependency between these PRs.

No GPU, PS5 hardware, actual game, macOS runtime or full system-library build is claimed. Hosted CI has not run for this new PR yet. AI assistance was used; the evidence and limitations above were checked locally.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5053508948 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12495). Originally posted by [StoneDC](https://github.com/StoneDC) on 2026-10-28T15:54:44Z. --- ### What Escapes ASCII control bytes 0x00..0x1F and 0x7F in progress basenames as literal \xNN, including when calculating display width; UTF-8 text is retained. Main integration now registers both console_progress and main's guest_load_ranges test targets. The production header and progress fixture are byte-identical to the preceding published head. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows/MinGW GCC 15.2 and Linux GCC 15.2: fresh relinker-only configure, production relinker build and both actual registered CTests console_progress + guest_load_ranges pass, zero skips. A separate build of the unchanged fixture against the real production header with only control escaping disabled fails the intended "Executable name was not escaped literally" assertion. The compile baseline passes; no compile/loader/setup failure is counted. Published head `dacbfbd9943fd8241167c4f05aa96ef510f8b8a9` integrates recorded main `dc9dc7eaaeaf99b1c491d426e68bb999def3da16`. Whitespace, per-head conventions with this full template, main ancestry, focused test registration and the 234-script registration audit pass. No assertion or timeout was weakened. These are focused relinker/tool checks; no full product, PS5/title, GPU or local macOS run is claimed. Fresh hosted checks remain pending until they complete. <details> <summary>Earlier implementation basis and validation (historical revisions)</summary> ### What ASCII control bytes in an input basename can inject terminal controls into progress output and distort its width accounting. Escape bytes 0–31 and 127 as literal \xHH in displayed basenames, using the escaped display for both messages and width. Preserve the underlying path, UTF-8 bytes and throttling behavior. Known limits: Only ASCII control bytes in displayed filenames are escaped. General Message text and Unicode terminal column counting are unchanged. No all-Unicode terminal-safety guarantee is claimed. Independent change based on main `f3eb573e6fc3`. Actual three-way merge of this exact head into the pre-publication main `f8f5b24b77ad` is clean. The overlap tool reports CMake insertion conflicts with #7173/#7531 and incomplete old-PR comparisons with #5021/#6713/#9793/#10861. Manual scoped diffs show separate ADX, process-parameter, Windows-path or code-scanning registrations, not this console feature. Keep both independent registration blocks; no dependency on those implementations or whole-peer build is claimed. Shared-file comparisons are scoped compatibility checks, not whole external-PR builds. ### Tested Windows 11 (MinGW GCC 15.2, Python 3.14.3, Node 24) and Ubuntu 26.04/WSL (GCC 15.2, Python 3.14.4, Node 22): windows: 1 focused CTest groups, 0 failures, 0 skipped; linux: 1 focused CTest groups, 0 failures, 0 skipped. Built the native relinker and console_progress_tests on both hosts. The actual console unit also passed Linux ASan+UBSan; the new assertion fails against the old header on both hosts. Commands (configure a Release Ninja build with `-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON`; native targets are built where affected): ```sh ctest --test-dir build -R '^console_progress$' --parallel 8 -V python3 tools/check_test_registration.py --scripts ``` Additional integration check: all 19 independent changes combined with main `17f8dfad513b` at `bbba7fc479a7` passed the affected Windows/WSL suites, native relinker build, registration and environment audit. The later observed main changes only an unrelated guest test; each exact PR head also merges cleanly into it. This combined check establishes composition, not a dependency between these PRs. No GPU, PS5 hardware, actual game, macOS runtime or full system-library build is claimed. Hosted CI has not run for this new PR yet. AI assistance was used; the evidence and limitations above were checked locally. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> </details> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
MarcZX10 commented 2026-10-28 15:56:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T15:56:15Z.

Review: COMMENTED


I reviewed head fa6bda9c04ee and ran the focused relinker test from a clean detached worktree on Linux/GCC 12.2: relinker-only CMake configure succeeded, console_progress_tests built, and ctest -R ^console_progress$ passed (1/1). I also ran tools/check_conventions.py --base upstream/main and tools/check_test_registration.py --scripts; both passed. The implementation escapes ASCII C0 and DEL bytes after extracting the basename and uses the rendered name when calculating the shared display width. The test covers terminal-control sequences, DEL, UTF-8 names, and all byte values in the control range. I found no correctness issue in this focused review. Hosted eligibility, conventions, intake, and labels checks were still queued at my last check, so this comment is not an approval or a claim that hosted CI passed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5685658924 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12495#pullrequestreview-5685658924). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T15:56:15Z. **Review:** COMMENTED --- I reviewed head `fa6bda9c04ee` and ran the focused relinker test from a clean detached worktree on Linux/GCC 12.2: relinker-only CMake configure succeeded, `console_progress_tests` built, and `ctest -R ^console_progress$` passed (1/1). I also ran `tools/check_conventions.py --base upstream/main` and `tools/check_test_registration.py --scripts`; both passed. The implementation escapes ASCII C0 and DEL bytes after extracting the basename and uses the rendered name when calculating the shared display width. The test covers terminal-control sequences, DEL, UTF-8 names, and all byte values in the control range. I found no correctness issue in this focused review. Hosted eligibility, conventions, intake, and labels checks were still queued at my last check, so this comment is not an approval or a claim that hosted CI passed.
rooklz commented 2026-10-28 16:17:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-28T16:17:50Z.

Review: APPROVED


First macOS run (the body has Windows + WSL only). Head fa6bda9c04, macOS 26.2 arm64, Apple clang, Release relinker-only lane.

  • Build clean. ctest 392/392, console_progress included (0.00 s). check_conventions --base upstream/main clean.
  • Red control: the PR test built against main's ConsoleProgress.hpp fails with Executable name was not escaped literally. Head passes, also under -fsanitize=address,undefined.
  • Mutants on the header, all killed by the new test:
    • drop == 0x7f
    • < 0x1f
    • width from the raw name (IncludeFile)
    • high/low nibble swapped (each side)
    • also escape >= 0x7f (the UTF-8 width assertion catches this)
    • lowercase hex
  • git merge-tree against current main 6793a72475 is clean. pr_overlap gives the same results the body lists: CMakeLists insertion points shared with #7173/#7531 and uncomparable #5021/#6713/#9793/#10861. None of them touch ConsoleProgress.
  • Scope matches the Known limits. The only external input that reaches Message with a filename is the basename in Converting …, and that path is escaped now. The other Message callers in Conversion.cpp print internal or relative names, which is outside this PR. Non-blocking: on POSIX, a file whose name literally contains \x1B displays the same as an escaped ESC. That's cosmetic. Backslash can't appear in the basename on Windows because it's a separator there.

AI-assisted review; every number above was reproduced locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5685979091 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12495#pullrequestreview-5685979091). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-28T16:17:50Z. **Review:** APPROVED --- First macOS run (the body has Windows + WSL only). Head `fa6bda9c04`, macOS 26.2 arm64, Apple clang, Release relinker-only lane. - Build clean. `ctest` 392/392, `console_progress` included (0.00 s). `check_conventions --base upstream/main` clean. - Red control: the PR test built against main's `ConsoleProgress.hpp` fails with `Executable name was not escaped literally`. Head passes, also under `-fsanitize=address,undefined`. - Mutants on the header, all killed by the new test: - drop `== 0x7f` - `< 0x1f` - width from the raw name (`IncludeFile`) - high/low nibble swapped (each side) - also escape `>= 0x7f` (the UTF-8 width assertion catches this) - lowercase hex - `git merge-tree` against current main `6793a72475` is clean. `pr_overlap` gives the same results the body lists: CMakeLists insertion points shared with #7173/#7531 and uncomparable #5021/#6713/#9793/#10861. None of them touch `ConsoleProgress`. - Scope matches the Known limits. The only external input that reaches `Message` with a filename is the basename in `Converting …`, and that path is escaped now. The other `Message` callers in `Conversion.cpp` print internal or relative names, which is outside this PR. Non-blocking: on POSIX, a file whose name literally contains `\x1B` displays the same as an escaped ESC. That's cosmetic. Backslash can't appear in the basename on Windows because it's a separator there. AI-assisted review; every number above was reproduced locally.
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
boykopovar/AnyPS5!12495
No description provided.