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

Open
opened 2026-11-26 20:19:28 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/875
Author: @trigger337
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: fix/bary-fallback-gs-stage-cleanup


📝 Commits (1)

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

📊 Changes

2 files changed (+41 additions, -2 deletions)

View changed files

📝 tests/test_bary_fallback_gs.py (+26 -0)
📝 tools/bary_fallback_gs.py (+15 -2)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/875 **Author:** [@trigger337](https://github.com/trigger337) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/bary-fallback-gs-stage-cleanup` --- ### 📝 Commits (1) - [`cfe8af7`](https://github.com/ubiquitarianism/leonida/commit/cfe8af7fcfe2652fc21e1ffe7545c9f162eda06b) bary_fallback_gs: restore write mode before unlink on replace failure and publish mode (BARY-FALLBACK-GS-STAGE-CLEANUP) ### 📊 Changes **2 files changed** (+41 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_bary_fallback_gs.py` (+26 -0) 📝 `tools/bary_fallback_gs.py` (+15 -2) </details> ### 📄 Description ### 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#913
No description provided.