mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:30:53 +01:00
[PR #719] glb_writer: restore writable mode before removing staging file on failure (GLB-WRITER-RO-CLEANUP) #758
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#758
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/719
Author: @kirigayakazima
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:fix/glb-writer-ro-cleanup📝 Commits (1)
bb27da2glb_writer: restore writable mode before removing staging file on failure📊 Changes
2 files changed (+46 additions, -0 deletions)
View changed files
📝
tests/test_glb_writer.py(+42 -0)📝
tools/glb_writer.py(+4 -0)📄 Description
Claimed in the coordination issue as: GLB-WRITER-RO-CLEANUP https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7131973085
What and why
In
tools/glb_writer.py(_write_bytes_atomic),os.chmod(tmp_path, published_mode(out_path))applies the destination file's mode to.glb-*.tmpbefore calling_replace(tmp_path, out_path). When publishing over a read-only (0o444).glbfails on Windows (or_replacefails while the staging file carries0o444),os.remove(tmp_path)inexcept BaseException:hitsPermissionError([WinError 5]), is swallowed byexcept OSError: pass, and leaves the orphaned.glb-*.tmpfile behind.Restores
0o600ontmp_pathbeforeos.remove(tmp_path)in the cleanup block (guarded withexcept OSError: pass) and adds two synthetic regression tests intests/test_glb_writer.py.Tested
Windows 11 x64, Python 3.14.7, CPU only, synthetic bytes only (no game files). Commit
bb27da204adb88f5d3c1178583f460dd7483c632.python -I tests/test_glb_writer.py -v:main(21625bca) with the two new tests: both fail (AssertionError: ['.glb-*.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/glb_writer.py tests/test_glb_writer.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.