bary_fallback_gs: restore write mode before unlink on replace failure and publish mode (BARY-FALLBACK-GS-STAGE-CLEANUP) #875

Open
github-bot wants to merge 1 commit from github-bot/gh-875 into main AGit
Owner

@⁠trigger337 on GitHub · 2026-11-24 14:53 UTC · original
trigger337:fix/bary-fallback-gs-stage-cleanup → main · +41 −2 · 2 files · 1 commits · open

Overview

In tools/bary_fallback_gs.py, apply published_mode to the staged temporary shader files before os.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.replace failure causes a PermissionError [WinError 5], leaving stranded temporary files behind and masking underlying exceptions.

Changes

  1. tools/bary_fallback_gs.py: Import published_mode, apply it to staged files before replacement, and restore write mode before directory cleanup in except BaseException:.
  2. tests/test_bary_fallback_gs.py: Add test_stage_cleanup_restores_write_mode_on_replace_failure asserting write mode restoration on replace failure.

agent: yes
AI-assisted: yes

**@⁠trigger337** on GitHub · 2026-11-24 14:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/875) `trigger337:fix/bary-fallback-gs-stage-cleanup` → `main` · +41 −2 · 2 files · 1 commits · open ### Overview In `tools/bary_fallback_gs.py`, apply `published_mode` to the staged temporary shader files before `os.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.replace` failure causes a `PermissionError` [WinError 5], leaving stranded temporary files behind and masking underlying exceptions. ### Changes 1. `tools/bary_fallback_gs.py`: Import `published_mode`, apply it to staged files before replacement, and restore write mode before directory cleanup in `except BaseException:`. 2. `tests/test_bary_fallback_gs.py`: Add `test_stage_cleanup_restores_write_mode_on_replace_failure` asserting write mode restoration on replace failure. agent: yes AI-assisted: yes
Apply published_mode(asm/spv) to temporary files before atomic replacement,
and restore write permission (0o600) before directory cleanup in exception block
when replace fails, preventing Windows PermissionError [WinError 5] and
stranded temporary files.

agent: yes
AI-assisted: yes
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:25:48 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:54 UTC · original · approved these changes

Audited and verified. Applies published_mode prior to atomic file replacement in ools/bary_fallback_gs.py and restores

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:54 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/875#pullrequestreview-6041572317) · **approved these changes** Audited and verified. Applies published_mode prior to atomic file replacement in ools/bary_fallback_gs.py and restores
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/875/head:github-bot/gh-875'
git switch 'github-bot/gh-875'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-875'
git switch 'github-bot/gh-875'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-875'
git switch 'github-bot/gh-875'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-875'
git switch 'main'
git merge --squash 'github-bot/gh-875'
git switch 'main'
git merge --ff-only 'github-bot/gh-875'
git switch 'main'
git merge 'github-bot/gh-875'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.