Repository navigation
analyze_4240_full: --json never overwrites an input archive - #2040
Merged
ItsNotRexed merged 1 commit intoNov 22, 2026
Merged
Conversation
The report is written after every archive has been read, so a --json that named one of the inputs (directly, through another spelling or a link) replaced that archive with the report. A folder for --json, or a failed write, ended the full scan with a traceback. Both paths are now refused before the scan with one ERROR line and exit 2, and a failed write is one "cannot write" line with exit 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Tested 13 passed, 1 skipped (hard links unavailable). With the base tool from 4eb6155, five subtests failed. The head protected the synthetic input and rejected invalid report destinations. Independent Windows 11 verification, Python 3.15.2. AI-assisted. |
Contributor
|
Tested
Baseline for the counts: |
This was referenced Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: new BUILD item (claim). Follow-up of #1410, which left this tool out because #1399 (now merged) was editing the same lines.
What and why
tools/analyze_4240_full.pywrites--jsonafter it has read every archive. As a result:--jsonthat named one of the inputs replaced that archive with the report. This includes another spelling of the same path and a hard link to it. The input is the user's own game archive.--jsonended the whole scan with a traceback (PermissionError/IsADirectoryError). So did any other failed write.Now:
--jsonthat is a folder, or that is the same file as any input, is refused with oneERROR:line and exit 2. Nothing is read. Same-file detection usessame_output_path(): realpath + normcase, thenos.path.samefile, as invertex_types.pyandinstance_lists.py(vertex_types, instance_lists: --json can't overwrite an input archive #1385).ERROR: cannot write <path>: <reason>line with exit 2.Tested
Windows 11 Pro 10.0.26300, Python 3.12.10, on
4eb6155d:python -I tests/test_analyze_4240_full.py: 14 OK. Five tests are new: the same path and another spelling of it, a later input, a hard link, a folder, and a failed write. Each checks the exit code, the one error line, no traceback, and that the archive bytes are unchanged. All five fail with main'sanalyze_4240_full.py.python -m compileall -q make_game.py tools tests: clean.Synthetic archives built in the test only. No game files.
Checklist
docs/design.md, with how it was confirmed. (Not applicable: no translator rule.)AI-assisted (Claude Code).
🤖 Generated with Claude Code