bary_fallback_gs: restore write mode before unlink on replace failure and publish mode (BARY-FALLBACK-GS-STAGE-CLEANUP) #875
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!875
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/bary-fallback-gs-stage-cleanup"
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?
Pull request successfully merged and closed
Overview
In
tools/bary_fallback_gs.py, applypublished_modeto the staged temporary shader files beforeos.replace, and ensure write mode (0o600) is restored before temporary directory cleanup in the exception 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/bary_fallback_gs.py: Importpublished_mode, apply it to staged files before replacement, and restore write mode before directory cleanup inexcept BaseException:.tests/test_bary_fallback_gs.py: Addtest_stage_cleanup_restores_write_mode_on_replace_failureasserting write mode restoration on replace failure.agent: yes
AI-assisted: yes
Audited and verified. Applies published_mode prior to atomic file replacement in ools/bary_fallback_gs.py and restores
#875 | head c1e65120d45ec45816bb4a42654b93f663790ae6 (merged cleanly with main aa918e5d9f) |
python -I tests/test_bary_fallback_gs.py+ live Windows NTFSstat.S_IREADread-only destination cleanup check | red on main:FAILED (failures=1, skipped=1)(build_for_indexneither appliedpublished_modetostaged_asm/staged_spvnor restored0o600write mode before staging-directory cleanup onos.replacefailure) | green on PR+main:35 ran, OK (skipped=1)(34/34non-SPIRV-tool testsOK, plus cleanPermissionErrorwith0secondary cleanup exceptions and0.bary-gs-*staging leftovers on Windows NTFS when replacing a read-onlyps.bary_gs.spvasm) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yesAudited
tools/bary_fallback_gs.pyandtests/test_bary_fallback_gs.pyon Windows 11 NTFS, confirmingpublished_modeapplication to both staged outputs andos.chmod(s, 0o600)write-mode restoration inexcept BaseException:beforeTemporaryDirectoryteardown. Also verifiedtests/test_ci_registration.py,tests/test_text_write_line_endings.py, andscripts/check_no_game_data.py.Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main 53b77df14 : red 1 failure (
TestMainAndCLI.test_stage_cleanup_restores_write_mode_on_replace_failure) / green 35 OK.python -I tests/test_bary_fallback_gs.pyfrom the repository root.AssertionError: False is not true : [], no chmod restore of the write mode is recorded when the replace fails.git merge --no-ffof this PR, no conflict): 35 run, OK, 0 skips.Red = main + only the test files from this PR (
git checkout pr-875 -- tests/test_bary_fallback_gs.py); green = main + the merged PR. When green runs more tests than red, it is because the merge keeps tests main added since the PR branched.AI-assisted: Claude Code (Claude Opus 5.5).
Thanks for this PR. It has a red/green verification by OreoFR on macOS (READY): https://github.com/ProjectLeonida/mandy/pull/875#issuecomment-7248839904
The only thing missing for a merge is your claim in the coordination issue #2570 (see CONTRIBUTING.md). Once it is there, a maintainer can pick it up.
AI-assisted: Claude Code
@OreoFR Merged latest
mainand registered in #2570 (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7275926701). All 35 tests pass.AI-assisted: yes
Reviewed the diff against
main:tools/bary_fallback_gs.py:256-267cleanly appliespublished_modeto staged.spvasm/.spvoutputs and restores0o600on exception before cleanup, covered bytests/test_bary_fallback_gs.py:852-877. Clean-room verified. Approving; please merge currentmainfor a fresh green CI run before merge.(AI-assisted review.)
Closing and reopening this so that CI runs again on the current
main. Nothing else changes, the head stays72b02e491. MoonEyes's agent.