rtti_scan: restore write mode before unlink on replace failure (RTTI-SCAN-STAGE-CLEANUP) #798
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/798"
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 ubiquitarianism/leonida. Originally posted by trigger337 on 2026-11-24T13:58:48Z.
In
tools/rtti_scan.py,write_reportcreates a temporary file and appliespublished_mode(path)beforeos.replace. If the target is read-only (e.g. 0o444),os.removein theexcept BaseExceptionblock fails on Windows withPermissionError(WinError 5) ifos.replacefails, leaving the temporary file behind.Align with the repository standard:
except BaseException, restore write permissions (try: os.chmod(tmp, 0o600); except OSError: pass) before callingos.remove.PermissionErrorhandling and cleanup on replace failure.Tests pass (31/31 in
test_rtti_scan.py),scripts/check_no_game_data.pypasses cleanly.agent: yes
AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-25T03:59:46Z.
Review: APPROVED
Approving. Merged into current main with no conflicts; the PR's tests pass (Linux, Python 3.13). Same pattern as the rest of the *-STAGE-CLEANUP series: on a failed replace the staged file gets 0o600 back before os.unlink, so a staged copy left read-only (the published mode on Windows) is still removed. Only the staging/permission lines change.
AI-assisted (Claude).
Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T20:49:36Z.
Reviewed
a6ff1f4: the staged-report cleanup when os.replace fails. I ran the PR'stests/test_rtti_scan.py: 31/31 pass on the PR tree, and on a main worktree with the PR's test file the new test fails (.rtti-*.tmpleft behind) while the other 30 pass, so it tests the fix. A probe with Windows-strict unlink reproduces the leak on main and its absence on the PR, with no change to the writable-destination path. compileall and check_no_game_data are clean. Findings: none. Optional follow-up outside this PR: the same pattern (staged file given the destination's read-only mode, then cleaned up without restoring write mode) appears in classify_carve.py:118, glb_writer.py:1078 and rsc8_audio.py:1966. AI-assisted review.Recommendation: Merge
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T19:34:02Z.
Red/green: tests/test_rtti_scan.py fails 1 assertion on main (a read-only staged .rtti- file is left behind when replace fails under a strict remove) and passes with the PR (cloud run on main
7daa4a4).Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main
7daa4a4a5in GitHub Actions: no new failure.AI-assisted (Claude Code, Claude Opus 5.5)
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:43:50Z.
Verified by OreoFR
4a54aedcb+ PR heada6ff1f4d3python -I tests/test_rtti_scan.pyAI-assisted (Claude Code, Claude Opus 5.5).