mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:25:53 +01:00
[PR #715] shader_link_check: restore writable mode before unlinking staging file on failure (SHADER-LINK-CHECK-RO-CLEANUP) #754
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#754
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/715
Author: @kirigayakazima
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:fix/shader-link-check-ro-cleanup📝 Commits (1)
940b0aeshader_link_check: restore writable mode before unlinking staging file on failure📊 Changes
2 files changed (+40 additions, -1 deletions)
View changed files
📝
tests/test_shader_link_check.py(+31 -0)📝
tools/shader_link_check.py(+9 -1)📄 Description
Claimed in the coordination issue as: SHADER-LINK-CHECK-RO-CLEANUP https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7131927852
What and why
In
tools/shader_link_check.py(write_report),os.chmod(temporary, published_mode(path))copies a read-only (0o444) report's mode onto.shader-link-*.tmpbeforeos.replace(temporary, path). Whenos.replacefails on Windows (including attempting to replace a read-only destination),finally:callstemporary.unlink(missing_ok=True)without restoring write permissions or catchingOSError:unlinkraises a secondPermissionErrorinsidefinally, masking the originalos.replaceexception (__context__)..shader-link-*.tmpstaging file is leaked in the output directory while the existing report stays intact.This clears
temporary = Noneafteros.replacesucceeds and restores0o600(withOSErrorguarded) before unlinkingtemporaryinfinally, adding two synthetic regression tests intests/test_shader_link_check.py.Tested
Windows 11 x64, Python 3.14.7, CPU only, synthetic inputs only (no game files). Commit
940b0ae227d694f1c96b046e325bc4d93f3030ee.python -I tests/test_shader_link_check.py -v:main(21625bca) with the two new tests: both new tests fail (secondPermissionErrorinfinallymasks theos.replacefailure and leaves.shader-link-*.tmp);python -I tests/test_ci_registration.py: 15 tests, OK.python -I tests/test_text_write_line_endings.py: 3 tests, OK.python -I scripts/check_no_game_data.py tools/shader_link_check.py tests/test_shader_link_check.py,python -m compileall -q tools tests,git diff --check: clean (exit0).GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.