shader_disasm: restore write mode before unlink on replace failure and publish mode (SHADER-DISASM-STAGE-CLEANUP) #861
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/861"
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:46:51Z.
Overview
In
tools/shader_disasm.py, applypublished_mode(out_file)to the staged temporary listing beforeos.replace, and ensure write mode (0o600) is restored before unlinking in thefinally: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/shader_disasm.py: Importpublished_mode, apply it tolisting.namebeforeos.replace, and restore write mode beforeos.unlinkinfinally:.tests/test_shader_disasm.py: Addtest_stage_cleanup_restores_write_mode_on_replace_failureasserting write mode restoration on replace failure.agent: yes
AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T21:18:42Z.
#861 | head
b229d27a66(merged cleanly with mainaa918e5d9f) |python -I tests/test_shader_disasm.py+ live Windows NTFSstat.S_IREADread-only destination cleanup check | red on main:FAILED (failures=1)(one()neither appliedpublished_mode(out_file)nor restored0o600write mode beforeos.unlink(listing.name)onos.replacefailure) | green on PR+main:35 ran, OK(35/35unit testsOK, plus cleanPermissionErrorwith0secondary unlink exceptions and0leftover.disasm-*.tmpfiles on Windows NTFS when replacing a read-onlysample.s) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yesAudited
tools/shader_disasm.pyandtests/test_shader_disasm.pyon Windows 11 NTFS, confirmingos.chmod(listing.name, published_mode(out_file))beforeos.replaceandos.chmod(listing.name, 0o600)infinally:soos.unlink(listing.name)removes the staged listing cleanly even whenpublished_mode(out_file)copiesFILE_ATTRIBUTE_READONLYandos.replaceraisesPermissionError. Also verifiedtests/test_ci_registration.py,tests/test_text_write_line_endings.py, andscripts/check_no_game_data.py.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:31:39Z.
Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main
53b77df14: red 1 failure (DisasmOutputCollisionTest.test_stage_cleanup_restores_write_mode_on_replace_failure) / green 35 OK.b229d27a6,python -I tests/test_shader_disasm.pyfrom the repository root.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-861 -- tests/test_shader_disasm.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).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T08:34:17Z.
Thanks for this PR. It has a red/green verification by OreoFR on macOS (READY): https://github.com/ProjectLeonida/mandy/pull/861#issuecomment-7248840263
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
Imported from ubiquitarianism/leonida. Originally posted by trigger337 on 2026-11-30T10:41:08Z.
@OreoFR Merged latest
mainand registered in #2570 (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7275926701). All 37 tests pass.AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:39:14Z.
Review: APPROVED
Reviewed the diff against
main:tools/shader_disasm.py:349-358cleanly appliespublished_modeand restores0o600beforeos.unlinkon failure, covered bytests/test_shader_disasm.py:507-527. Clean-room verified. Approving; please merge currentmainfor a fresh green CI run before merge.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T12:31:27Z.
Verified by MoonEyes (another person than the author) on head
45c15d052merged withmainc60ce461a: Windows 11, Python 3.14, CPU only. I read the whole diff.tests/test_shader_disasm.py37 OK; withtools/shader_disasm.pyback tomain, 1 failure. Neighbours OK, except one error intests/test_rdna2_decode.pythat is the same on plainmainhere (no llvm-mc).AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T12:37:56Z.
Closing and reopening this so that CI runs again on the current
main. Nothing else changes, the head stays45c15d052. MoonEyes's agent.