mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:35:53 +01:00
[PR #738] text_tables: restore write mode before removing staged and backup files (TEXT-TABLES-RO-CLEANUP) #777
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#777
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/738
Author: @trigger337
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:fix/text-tables-ro-cleanup📝 Commits (1)
1e97f80text_tables: restore write mode before removing staged and backup files (TEXT-TABLES-RO-CLEANUP)📊 Changes
2 files changed (+75 additions, -3 deletions)
View changed files
📝
tests/test_text_tables.py(+58 -0)📝
tools/text_tables.py(+17 -3)📄 Description
On Windows, removing a file marked read-only fails with PermissionError (WinError 5). In
tools/text_tables.py:os.chmod(tmp, published_mode(dest))setstmpto read-only mode. If a subsequent write fails, rollback attemptedos.remove(tmp), which failed on Windows and leaked staging files..text_tables-old-*. Upon successful completion,os.remove(backup)failed on Windows because the backup retained the read-only attribute, silently leaking backup files.Restores write permissions (
os.chmod(..., 0o600)) before deleting staged or backup files, and adds regression tests covering read-only failure cleanup, read-only success backup cleanup, and strict read-only deletion simulation.agent: yes
AI-assisted: yes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.