fix(tools): report sanitizer_report symlink-loop summary paths without traceback #13189

Closed
rooklz wants to merge 2 commits from upstream-pr/13189 into main
rooklz commented 2026-10-30 05:48:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-30T05:48:28Z.


What

sanitizer_report compares --summary against --junit / --known with Path.resolve(). On Python 3.9–3.12, a looping symbolic link used as --summary raises RuntimeError: Symlink loop from resolve(), which is not handled by the tool's (OSError, ET.ParseError, ValueError) handler, so the user gets a traceback and exit status 1 instead of the usual sanitizer_report: message and exit status 2. The alias check now uses os.path.realpath, matching the other CI summary tools.

Tested

  • macOS arm64: new test_symlink_loop_summary_reports_error_without_traceback passes; existing SummaryInputAliasTests unchanged.
  • python3 tools/check_conventions.py --base upstream/main — PASS.
  • python3 tools/pr_overlap.py --branch fix/sanitizer-report-symlink-loop — merge-order with PR #12872 at tools/sanitizer_report.py L1 (import line only; rebase onto #12872 or land second with a one-line port).
  • Relinker-only build + ctest --test-dir build-relinker -j 8: 513/513.

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:5080089222 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13189). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-30T05:48:28Z. --- ### What `sanitizer_report` compares `--summary` against `--junit` / `--known` with `Path.resolve()`. On Python 3.9–3.12, a looping symbolic link used as `--summary` raises `RuntimeError: Symlink loop` from `resolve()`, which is not handled by the tool's `(OSError, ET.ParseError, ValueError)` handler, so the user gets a traceback and exit status 1 instead of the usual `sanitizer_report:` message and exit status 2. The alias check now uses `os.path.realpath`, matching the other CI summary tools. ### Tested - macOS arm64: new `test_symlink_loop_summary_reports_error_without_traceback` passes; existing `SummaryInputAliasTests` unchanged. - `python3 tools/check_conventions.py --base upstream/main` — PASS. - `python3 tools/pr_overlap.py --branch fix/sanitizer-report-symlink-loop` — merge-order with PR #12872 at `tools/sanitizer_report.py` L1 (import line only; rebase onto #12872 or land second with a one-line port). - Relinker-only build + `ctest --test-dir build-relinker -j 8`: 513/513. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical 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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-22 09:04:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T09:04:51Z.

Review: APPROVED


Reviewed — looks good

The change uses os.path.realpath for summary alias checks and adds a subprocess regression test for a looping summary symlink at head 69fe810b1113b8199ff899718ca6617ca56ef1c4; source inspection supports the described error handling, but I did not run tests.

What I ran

Read the prepared diff and both changed files through repo_read.py. No commands or tests were run.

Results

Check Result Note
Source review passed Both changed files read
Automated checks not run No test output available

Findings

Blocking

None.

Non-blocking

None.

Not verified

The author reports macOS test and convention-check passes and a 513/513 CTest run; these results were not independently verified. No runtime or platform-specific checks were run. Both changed files listed in the manifest were read; no exclusions were listed in the manifest. files.json was not available through the reader.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011421588 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13189#pullrequestreview-6011421588). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T09:04:51Z. **Review:** APPROVED --- # Reviewed — looks good The change uses `os.path.realpath` for summary alias checks and adds a subprocess regression test for a looping summary symlink at head `69fe810b1113b8199ff899718ca6617ca56ef1c4`; source inspection supports the described error handling, but I did not run tests. ## What I ran Read the prepared diff and both changed files through `repo_read.py`. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Both changed files read | | Automated checks | not run | No test output available | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The author reports macOS test and convention-check passes and a 513/513 CTest run; these results were not independently verified. No runtime or platform-specific checks were run. Both changed files listed in the manifest were read; no exclusions were listed in the manifest. `files.json` was not available through the reader. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 01:04:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T01:04:22Z.

Review: COMMENTED


I checked the reported failure on Python 3.12.13 on Linux, where Path.resolve() still raises RuntimeError on a symlink loop. Current main (ac7ee4bb) already exits 2, emits a single sanitizer_report: Symlink loop diagnostic with empty stdout, and leaves the input unchanged. The PR head gives the same contract with an OS error message. The current main handler came from 0109bf14d2 and catches RuntimeError directly. That explains why the previous negative control also passed. As the PR now conflicts with main, I'd keep the real-loop CLI fixture only if its subprocess coverage is still wanted.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6161897198 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13189#pullrequestreview-6161897198). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T01:04:22Z. **Review:** COMMENTED --- I checked the reported failure on Python 3.12.13 on Linux, where `Path.resolve()` still raises `RuntimeError` on a symlink loop. Current `main` (`ac7ee4bb`) already exits 2, emits a single `sanitizer_report: Symlink loop` diagnostic with empty stdout, and leaves the input unchanged. The PR head gives the same contract with an OS error message. The current main handler came from `0109bf14d2` and catches `RuntimeError` directly. That explains why the previous negative control also passed. As the PR now conflicts with main, I'd keep the real-loop CLI fixture only if its subprocess coverage is still wanted. AI-assisted: yes.

Pull request closed

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!13189
No description provided.