mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:30:53 +01:00
[PR #1655] text_tables: refuse a report that would overwrite a file read from a source directory (TEXT-TABLES-SOURCE-FILE-GUARD) #1669
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#1669
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/1655
Author: @PierreEbele
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:text-tables-source-file-guard📝 Commits (1)
e231d2ctext_tables: refuse a report that would overwrite a file read from a source directory📊 Changes
2 files changed (+64 additions, -0 deletions)
View changed files
📝
tests/test_text_tables.py(+40 -0)📝
tools/text_tables.py(+24 -0)📄 Description
What changes
tools/text_tables.pychecked--dialogue/--tables/--stringsonly against the named sources and a carve'sindex.json. Butblobs()also reads every file below a plain source directory and every carved<offset:012x>.bin/.bk2besideindex.json, so a report path naming one of those files was read as input and then replaced by the CSV, with exit 0:The tool now refuses such a report before anything is written (
--tables would overwrite the input src/notes.txt, exit 2):report_paths.same_report_path) with every file below the source, only when the report already exists;gamedata_index.carved_stream()is reused, the same guardgamedata_index.pyapplies to its own reports (so the case/hard-link hardening proposed in #1578 applies here too).A new report inside a source directory is still written: it is created after the scan, so it was never an input (covered by a test).
The new check sits right after the existing
index.jsoncheck; it does not touch the lines changed by #1228, #738 or #818.Tests
Run in a sandbox (Linux, no network):
tests/test_text_tables.py: 36 OK (1 Windows-only skip) on this branch; with the new tests on main's tool,test_report_cannot_replace_a_file_read_from_a_source_directoryandtest_report_cannot_replace_a_carved_streamfail.test_report_paths.py,test_report_path_case.py,test_missing_input_exit_codes.py,test_gamedata_index.py: OK.scripts/check_no_game_data.py tools/text_tables.py tests/test_text_tables.py: clean. Synthetic fixtures only, no game data.Claimed in the coordination issue as: TEXT-TABLES-SOURCE-FILE-GUARD
AI-assisted.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.