[PR #786] bink_names: restore write mode before unlink on replace failure and publish mode on Windows (BINK-NAMES-STAGE-CLEANUP) #824

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

📋 Pull Request Information

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

Base: main ← Head: fix/bink-names-stage-cleanup


📝 Commits (1)

  • 1b7344c bink_names: restore write mode before unlink on replace failure and publish mode on Windows (BINK-NAMES-STAGE-CLEANUP)

📊 Changes

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

View changed files

📝 tests/test_bink_names.py (+37 -0)
📝 tools/bink_names.py (+5 -2)

📄 Description

In tools/bink_names.py, write creates a temporary file and previously skipped applying published_mode on Windows because os.unlink in the finally block fails with PermissionError (WinError 5) if replace_retry fails on read-only destinations.

Align with the repository standard:

  1. In finally, restore write permissions (try: os.chmod(staged.name, 0o600); except OSError: pass) before unlinking.
  2. Apply published_mode(destination) unconditionally so Windows outputs receive proper permissions instead of keeping NamedTemporaryFile's default 0o600 mode.
  3. Add synthetic regression tests verifying PermissionError handling and Windows published_mode application.

Tests pass (38/38 in test_bink_names.py), scripts/check_no_game_data.py passes cleanly.

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/786 **Author:** [@trigger337](https://github.com/trigger337) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/bink-names-stage-cleanup` --- ### 📝 Commits (1) - [`1b7344c`](https://github.com/ubiquitarianism/leonida/commit/1b7344c20e5be5887f6ce37aab50eea70c909ebc) bink_names: restore write mode before unlink on replace failure and publish mode on Windows (BINK-NAMES-STAGE-CLEANUP) ### 📊 Changes **2 files changed** (+42 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_bink_names.py` (+37 -0) 📝 `tools/bink_names.py` (+5 -2) </details> ### 📄 Description In `tools/bink_names.py`, `write` creates a temporary file and previously skipped applying `published_mode` on Windows because `os.unlink` in the `finally` block fails with `PermissionError` (WinError 5) if `replace_retry` fails on read-only destinations. Align with the repository standard: 1. In `finally`, restore write permissions (`try: os.chmod(staged.name, 0o600); except OSError: pass`) before unlinking. 2. Apply `published_mode(destination)` unconditionally so Windows outputs receive proper permissions instead of keeping `NamedTemporaryFile`'s default `0o600` mode. 3. Add synthetic regression tests verifying `PermissionError` handling and Windows `published_mode` application. Tests pass (38/38 in `test_bink_names.py`), `scripts/check_no_game_data.py` passes cleanly. 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#824
No description provided.