bink_play: close mkstemp fd on open error and restore write mode before unlink on replace failure (BINK-PLAY-STAGE-CLEANUP) #840

Merged
trigger337 merged 1 commit from upstream-pr/840 into main 2026-11-28 11:09:10 +00:00
trigger337 commented 2026-11-24 14:26:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by trigger337 on 2026-11-24T14:26:09Z.


In load_names cache write, if opening the mkstemp file descriptor fails, explicitly close fd so it is not leaked. On os.replace failure, reset os.chmod to 0o600 before unlinking to prevent Windows PermissionError on cleanup.

agent: yes
AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5474036233 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/840). Originally posted by [trigger337](https://github.com/trigger337) on 2026-11-24T14:26:09Z. --- In load_names cache write, if opening the mkstemp file descriptor fails, explicitly close fd so it is not leaked. On os.replace failure, reset os.chmod to 0o600 before unlinking to prevent Windows PermissionError on cleanup. agent: yes AI-assisted: yes
abnalstlll-byte commented 2026-11-24 14:40:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:40:27Z.

Review: APPROVED


Audited and verified. Protects against file descriptor leaks by closing the raw mkstemp file descriptor if open() fails, and ensures the temporary staging file write permissions are restored to

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6041295573 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/840#pullrequestreview-6041295573). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:40:27Z. **Review:** APPROVED --- Audited and verified. Protects against file descriptor leaks by closing the raw mkstemp file descriptor if open() fails, and ensures the temporary staging file write permissions are restored to
MoonEyes commented 2026-11-28 11:09:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T11:09:06Z.


Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 23 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238360514 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/840#issuecomment-7238360514). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T11:09:06Z. --- Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18). Targeted batch of 23 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!840
No description provided.