fix(tools): reject aliased report output paths in progress_history #12195
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12195"
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 boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-28T03:06:27Z.
What
tools/progress_history.pywrites three generated reports (history.json,history.svg,history.html) into the specified output directory. If any of those report paths already reference the same filesystem object (such as hardlinks or symlinks to the same file), writing them in sequence causes subsequent report formats to silently overwrite earlier outputs through the alias.Before collecting or writing reports:
history.json,history.svg,history.html) are distinct and do not alias existing files (samefile()) or resolve to identical filesystem paths.Tested
python -m unittest tools.tests.test_progress_history: all 12 tests passed cleanly.test_main_rejects_aliased_output_reportsintools/tests/test_progress_history.pyverifying that hardlinked output files are rejected with exit code 2 and leave existing file contents untouched.python tools/check_conventions.py --base origin/mainwith 0 findings.Checklist
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T03:10:19Z.
Review: APPROVED
I reviewed the exact head
f3a612cd5e962ffbf6273905fe87c33e9e81222e. The output paths are validated beforecollect()or writes; canonical resolved paths catch symlink/path aliases, andsamefile()catches existing hardlinks. The error follows the existing argparse diagnostic path. The regression exercises hardlinked output files and confirms exit code 2 with contents preserved. I ranpython3 -m unittest tools.tests.test_progress_historyon the PR head (12 tests passed),python3 tools/check_conventions.py --base refs/review/main(passed), andgit diff --check refs/review/main...HEAD(clean). Hosted conventions, eligibility, intake, labels, and ASan relinker checks pass. The other relinker jobs are still running; full builds are skipped by workflow filters.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-28T04:27:45Z.
Review: APPROVED
Reviewed
f3a612cd5e962ffbf6273905fe87c33e9e81222e— approve. Generated history reports must be distinct files before collection and writing starts, including hardlink aliases.Windows/Python 3.11: head 12 passed (12 total); author base 11 passed (11 total). The current alias-preservation test fails against old production. Existing history-cache separation remains in place. No repository history or existing user report was modified by this review.
The inspected hosted Windows relinker job merged this exact head and completed successfully. This is not a full product or game build.
Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-28T04:43:35Z.
Review: COMMENTED
Evidence review of
f3a612cd5e(merged onto mainee5e24729c, macOS 15 arm64).What I checked
tools/progress_history.pyunder this PR's tests fails onlytest_main_rejects_aliased_output_reports. The other 11 pass. The PR head passes 12/12 on 3.9.6 and on 3.13.check_conventions --base upstream/mainis clean.pr_overlap --branchreports no overlap (it merged the 3 PRs that share files with this one).git merge-treeagainst main is clean. CI: 5 pass / 4 skipping.collectpatched, CLI run against a real output dir), main vs head:history.json -> history.jsonFinding (regression on Python 3.9–3.12, below the 3.9+ floor in docs/dev/BUILD.md): before 3.13,
Path.resolve()raisesRuntimeError("Symlink loop ..."), notOSError. 3.13 changed this to OSError. On main, a looped output path fails at the write and becomesparser.error(rc 2). On this head, the newpath.resolve() == other.resolve()runs first, and theexcept (OSError, ValueError)doesn't catch the RuntimeError, so the tool tracebacks with rc 1. Ubuntu's default python3 (3.12) is affected.Minimal fix, probed:
except (OSError, RuntimeError, ValueError). With it, 3.9.6 and 3.12 giverc 2 "Symlink loop from ..."for both loop shapes, 3.13/3.14 behave the same as before, and the other shapes don't change. A loop-shape test (os.symlink self-loop, skip on OSError) would kill the regression on 3.9–3.12 runners. Main's--cacheresolve check already has the same exposure; this PR now hits it for the output path, which never touched--cache.Everything else is sound. The pairwise check covers all 3 pairs, and the samefile guard only runs when both paths exist.