mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:45:54 +01:00
[PR #1360] rootsig_census: guard --json with same_report_path and catch write OSError (ROOTSIG-CENSUS-JSON-GUARD) #1390
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#1390
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/1360
Author: @JesusACD
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:fix/rootsig-census-json-guard📝 Commits (2)
8270eaerootsig_census: guard --json inputs with same_report_path and catch write OSError (ROOTSIG-CENSUS-JSON-GUARD)85b44ddrootsig_census: reserve root and disasm index.json paths before first write (ROOTSIG-CENSUS-JSON-GUARD)📊 Changes
2 files changed (+143 additions, -9 deletions)
View changed files
📝
tests/test_rootsig_census.py(+92 -0)📝
tools/rootsig_census.py(+51 -9)📄 Description
Claimed in the coordination issue as: ROOTSIG-CENSUS-JSON-GUARD (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146264254)
What and why
tools/rootsig_census.pypreviously checked--jsononly withos.path.samefile(a.root, a.json)(:298-303) and wrote--jsonwithout catchingOSError(:331-334):--jsonnaming an unpacked input or manifest (<root>/<name>.dxbc,<root>/fspx/<name>.json,<root>/index.json, or<disasm>/<name>.s/<disasm>/index.jsonwhen--disasmis given) — directly, via another relative spelling, a link, or a case-folded alias — was not refused and overwrote the file.--jsonnaming--disasmor any existing directory other thanrootran the entire census first and then crashed with an unhandledIsADirectoryError/PermissionErrortraceback.--jsonpaths crashed with an unhandledOSErrortraceback instead of reporting a one-line error with exit code2.This switches
tools/rootsig_census.pytotools/report_paths.same_report_path(perCONTRIBUTING.md), refuses directory targets and input/manifest collisions before scanning, creates missing parent directories for--json, and catchesOSErroron write to printerror: cannot write <path>: <reason>tostderrand exit2.Tested
python -m compileall -q make_game.py tools tests: clean.python -I make_game.py --helpandpython -I tools/rootsig_census.py --help: clean.python -I tests/test_rootsig_census.py -v: 30 passed (added 5 regression tests covering input/manifest preservation, delegation tosame_report_path, pre-scan directory refusal, nested parent creation, and cleanOSErrorreporting on Windows 11 / Python 3.13.17).python -I tests/test_report_paths.py,python -I tests/test_report_path_case.py, andpython -I tests/test_text_write_line_endings.py: 28 passed, 1 skipped.python -I scripts/check_no_game_data.py tools/rootsig_census.py tests/test_rootsig_census.py: clean.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.