native_pso_hashes: restore write mode before unlink on replace failure and publish mode (NATIVE-PSO-HASHES-STAGE-CLEANUP) #845
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/845"
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-24T14:29:46Z.
Overview
In
tools/native_pso_hashes.py, applypublished_mode(out)before atomic replacement, and ensure write mode (0o600) is restored before unlinking in the finally block if replacement fails.On Windows, unlinking a read-only staged file or cleaning up on
os.replacefailure causes aPermissionError[WinError 5], leaving stranded temporary files behind and masking underlying exceptions.Changes
tools/native_pso_hashes.py: Importpublished_mode, apply it beforeos.replace, and restore write permissions before unlinking.tests/test_native_pso_hashes.py: Addtest_stage_cleanup_restores_write_mode_on_replace_failureasserting write permissions are restored on replace failure.agent: yes
AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:31:10Z.
Review: APPROVED
Clean-Room Peer Review for PR #845 (native_pso_hashes: restore write mode before unlink on replace failure and publish mode)
Consistent staging file permissions and atomic replacement hygiene:
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:39:31Z.
Review: APPROVED
Audited and verified. Applies published_mode(out) before atomic replacement and restores write permission
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T11:09:30Z.
Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 23 PRs (their tests, the tests importing the changed modules, the docs tests) on main
3ca0707: no new failure, Linux / Python 3.13.AI-assisted (Claude Code, Claude Opus 5.5)