[PR #755] fragment_children: restore write mode before unlink on replace failure and publish mode on Windows (FRAGMENT-CHILDREN-STAGE-CLEANUP) #793

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

📋 Pull Request Information

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

Base: main ← Head: fix/fragment-children-stage-cleanup


📝 Commits (1)

  • dd4f402 fragment_children: restore write mode before unlink on replace failure and publish mode on Windows (FRAGMENT-CHILDREN-STAGE-CLEANUP)

📊 Changes

2 files changed (+43 additions, -3 deletions)

View changed files

📝 tests/test_fragment_children.py (+37 -0)
📝 tools/fragment_children.py (+6 -3)

📄 Description

In tools/fragment_children.py write_json_report:

  1. os.chmod(staged.name, published_mode(destination)) was skipped on Windows (if os.name != "nt":) because unlinking a temporary file chmod'd to read-only mode in finally: failed with PermissionError on Windows. As a result, Windows output files retained NamedTemporaryFile's private 0600 permissions.
  2. Ensure os.chmod(staged.name, 0o600) before os.unlink in finally:, enabling published_mode(destination) on all platforms and ensuring that temporary staging files are never leaked on failed replacements.
  3. Added regression tests in tests/test_fragment_children.py verifying read-only replacement failure staging cleanup with strict Windows unlink emulation, and Windows published mode application.

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/755 **Author:** [@trigger337](https://github.com/trigger337) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/fragment-children-stage-cleanup` --- ### 📝 Commits (1) - [`dd4f402`](https://github.com/ubiquitarianism/leonida/commit/dd4f4023558ead63a54bcf3166514aac44f5b5ad) fragment_children: restore write mode before unlink on replace failure and publish mode on Windows (FRAGMENT-CHILDREN-STAGE-CLEANUP) ### 📊 Changes **2 files changed** (+43 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_fragment_children.py` (+37 -0) 📝 `tools/fragment_children.py` (+6 -3) </details> ### 📄 Description In `tools/fragment_children.py` `write_json_report`: 1. `os.chmod(staged.name, published_mode(destination))` was skipped on Windows (`if os.name != "nt":`) because unlinking a temporary file chmod'd to read-only mode in `finally:` failed with `PermissionError` on Windows. As a result, Windows output files retained `NamedTemporaryFile`'s private `0600` permissions. 2. Ensure `os.chmod(staged.name, 0o600)` before `os.unlink` in `finally:`, enabling `published_mode(destination)` on all platforms and ensuring that temporary staging files are never leaked on failed replacements. 3. Added regression tests in `tests/test_fragment_children.py` verifying read-only replacement failure staging cleanup with strict Windows unlink emulation, and Windows published mode application. 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#793
No description provided.