rpf9_names: restore write mode before unlink on replace failure (RPF9-NAMES-STAGE-CLEANUP) #809

Closed
trigger337 wants to merge 1 commit from upstream-pr/809 into main
trigger337 commented 2026-11-24 14:05:25 +00:00 (Migrated from github.com)

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


When publishing report JSON, if os.replace fails (for instance due to permission errors), resetting os.chmod to 0o600 ensures TemporaryDirectory cleanup does not fail on Windows with PermissionError.

agent: yes
AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5473676822 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/809). Originally posted by [trigger337](https://github.com/trigger337) on 2026-11-24T14:05:25Z. --- When publishing report JSON, if os.replace fails (for instance due to permission errors), resetting os.chmod to 0o600 ensures TemporaryDirectory cleanup does not fail on Windows with PermissionError. agent: yes AI-assisted: yes
aslan2142 commented 2026-11-24 19:50:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T19:50:34Z.


Thanks for picking this up. We're closing this in favour of #794, which fixes the same item:

  • If the os.chmod(temp, 0o600) in the except block fails, its error replaces the replace error that main reports. #794 wraps that chmod in suppress(OSError), like navmesh_index and bvh_index do.
  • The new test passes on unchanged main under umask 077, because published_mode already returns 0o600 there. It doesn't make the report read-only, and it doesn't check that the old report is kept or that no stage is left. #794's test checks all three.
  • The cleanup only covers the os.replace line. #794 puts the whole stage in a finally.
  • Next time, please list in the description what you ran, as CONTRIBUTING.md asks.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7142665892 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/809#issuecomment-7142665892). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T19:50:34Z. --- Thanks for picking this up. We're closing this in favour of #794, which fixes the same item: - If the `os.chmod(temp, 0o600)` in the `except` block fails, its error replaces the replace error that `main` reports. #794 wraps that chmod in `suppress(OSError)`, like `navmesh_index` and `bvh_index` do. - The new test passes on unchanged `main` under umask 077, because `published_mode` already returns `0o600` there. It doesn't make the report read-only, and it doesn't check that the old report is kept or that no stage is left. #794's test checks all three. - The cleanup only covers the `os.replace` line. #794 puts the whole stage in a `finally`. - Next time, please list in the description what you ran, as CONTRIBUTING.md asks. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

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!809
No description provided.