fix(tools): report symlink-looping suggest_patches directories as usage errors #12340
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12340"
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 rooklz on 2026-10-28T10:16:57Z.
What
suggest_patchesprinted a traceback when--catalogor--sce-module-path(or the input's parent directory) was a symbolic link loop (ln -s loop loop). It does not give its usage error in that case.Both directories go through
Path.resolve()inmain. On Python 3.11–3.12 (the tool needstomllib, so 3.11 is the minimum), that raisesRuntimeError("Symlink loop ..."). The handler isexcept (OSError, ValueError, ...), so the error goes uncaught and the exit code is 1. On 3.13+resolve()doesn't raise, and the run ends with the existingPatch advisor:error, exit 2.Both directories now use
os.path.realpath, which doesn't raise for a loop on any version. The catalog directory is resolved once and reused byload_catalogandvalidate_entry, so behaviour is unchanged for normal paths. A looping catalog now reachesconfined(), which already turns the loop intoinvalid relative path: 'index.json': Symlink loop .... A looping module parent hits the existingmodule parent must be a directorycheck. Both exit 2 before the relinker runs, the same as on 3.13+.Tested
macOS arm64. New
test_directory_symlink_loop_is_a_usage_errorputs the loop at--catalogand at--sce-module-path. For each it checks exit 2, aPatch advisor:message and that the relinker was never run.RuntimeError: Symlink loop)resolve()doesn't raise there)test_suggest_patches36 OK on 3.12, 3.13, 3.14 and 3.15no catalog entry, exit 1ctest378/378 on main3a40945e62check_conventions --base upstream/mainandpr_overlapcleanChecklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T10:52:07Z.
Review: APPROVED
Reviewed the path normalization change and the symlink-loop regression. The exact-head focused suite passed 36 tests locally; the loop case is checked for both
--catalogand--sce-module-pathand confirms the relinker is not invoked. Hosted Ubuntu and Windows relinker checks pass. macOS relinker jobs are still pending, so no macOS run is claimed.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-28T11:53:06Z.
Review: APPROVED
Reviewed
800599a8465b207ba175203f9ab24f8143436d6a— approve. Patch-advisor catalog/module directory loops are converted into usage errors rather than escaping through Path.resolve. The resolved catalog path is reused for validation.Windows/Python 3.11: head test_suggest_patches.py: 33 passed, 3 skipped (36 total); base test_suggest_patches.py: 33 passed, 2 skipped (35 total). The independent real-junction fixture returns exit 2 without a traceback on head and exit 1 with a traceback on base. Neither the metadata nor the existing independent output is modified. No title conversion or patch applicability is claimed.
Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-10-30T10:16:54Z.
Review: APPROVED
Reviewed exact current head e8bb5b47ccf315591d97aa48582bc740ef083efc. tools/tests/test_suggest_patches.py passes 38 tests on Windows Python 3.12 with 4 expected filesystem/symlink skips and 38/38 on WSL Python 3.12. Current-main merge-tree is clean and git diff --check is clean; the hosted Build is fully green across Ubuntu/Windows/macOS relinker, ASan and eligibility. I also verified that this head's two touched blobs are byte-identical to the #12340 snapshot already integrated and tested in #12769's proposed prerequisite stack, so approving this live head does not introduce a divergence from that integration. No blocking issue found.
Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-10-30T11:29:57Z.
Review: APPROVED
Re-checked exact current head 55868bca499c14fcf2a3aa3a607785d4fba4b183. The two touched blobs are byte-identical to the exact head I previously tested and approved (suggest_patches.py
dc4f9cf41b; test_suggest_patches.py20bdd49e9c). Current-main merge-tree is clean and git diff --check passes. The refreshed hosted run has eligibility green and the platform relinker jobs queued; no implementation/test change was introduced by this rebase. My prior Windows/WSL exact-behavior validation still applies. No blocking issue found.