Repository navigation
fix(tools): report configure_seed symbolic link loops as usage errors - #12614
Conversation
|
Windows run of this head (
AI-assisted: yes (Claude Code). |
THEMANnt
left a comment
There was a problem hiding this comment.
Reviewed 1ff12a6f7cf2eca3df75e046a68cca1a29fe808e against c9207624bc0ac70bac2878062bd27bcaa44d109f. Seed output resolution uses non-strict real paths followed by explicit stat/write errors, while preserving cache/output alias checks and staged seed writes. No actionable finding in this scoped review.
Windows/Python 3.11 validation: head 23 passed, 5 skipped; baseline 23 passed, 4 skipped. Independent real Windows junction-loop CLI control: head exits 2 without traceback; baseline exits 1 with RuntimeError. Input cache bytes are unchanged and the verified junction is removed. Ordinary symlink/permission tests remain skipped; their old-code control passes due to those skips and is not counted as proof.
df28236 to
f1b3ad6
Compare
|
Coordination note with #13278: current #12614 adds one new subprocess call in est_symbolic_link_loops_are_reported_without_a_traceback using capture_output=True, text=True. #13278 fixes the same test module's configure_seed subprocess decoding by using encoding='utf-8', because the tool explicitly emits UTF-8 and locale decoding fails under paths such as C:\tmp\e_é on ACP1252 Windows. The two branches merge cleanly, so there is no landing-order conflict; please carry the same encoding='utf-8' adjustment into this added subprocess if #12614 lands after #13278. This is coordination only, not a functional objection to the symlink-loop fix. |
b46dce8 to
1ab2447
Compare
1ab2447 to
b881eeb
Compare
What
configure_seedchecks that the seed output isn't the input cache by comparingPath.resolve()of both, andwrite_seedresolves the output again. When either path is a symbolic link loop (ln -s loop loop),resolve()raisesRuntimeError("Symlink loop ...")on Python 3.9–3.12. That isn't anOSError, so the tool prints a traceback and exits 1 instead of giving its usage error.On 3.13+
resolve()doesn't raise, and there is a second problem. With a looping seed output,destination.exists()returns False, sowrite_seedtreats the loop as a missing file,os.replaceswaps a regular file in for the link, and the tool exits 0 with0 check results. So the user's link is silently replaced.Both checks now use
os.path.realpath, which returns the looping path on every version without raising.write_seedcallsstat()and treats onlyFileNotFoundErroras "no existing seed", so a loop raisesELOOPthrough the existingexcept OSErrorhandler. Now a looping cache or seed exits 2 withconfigure_seed.py: error: <path>: [Errno 62] Too many levels of symbolic links, and nothing is written or replaced. This is the same fix #12331 and #12338 made forpad_timelineandprepare_release_notes.Tested
macOS arm64. New
ConfigureSeedPathTests.test_symbolic_link_loops_are_reported_without_a_tracebackruns with the loop as the seed output and again with the loop as the input cache. It checks for exit 2, empty stdout, the path in stderr, no traceback, the link left in place, no seed file created and the cache unchanged:tools.tests.test_configure_seedOK on 3.9.6, 3.12, 3.13, 3.14 and 3.15write_seedback toresolve()fails on 3.9 (passes on 3.13, where only thestat()hunk matters). The alias check back toresolve()fails on 3.9.exists()back in place ofstat()fails on both 3.9 and 3.13.ctest392/392 on main c920762check_conventions --base upstream/mainclean.pr_overlapfound no overlap. fix(tools): parse quoted CMake cache check names in configure_seed #12174 (quoted cache names, same file) changes only thechecks()parser lines, andgit merge-treewith this branch is clean.Checklist
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)