Skip to content

pe_inspect: require --out so a run never writes into the checkout (EGEN-PEINSPECT-OUT-REQUIRED) - #6212

Open
evilclanker9000 wants to merge 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/9-peinspect-out-required
Open

evilclanker9000 wants to merge 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/9-peinspect-out-required

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

tools/pe_inspect.py resolved its --out default as os.path.join(os.path.dirname(__file__), "..", "reports", "pe"), so any run that omitted --out wrote <checkout>/reports/pe/<file>.json and .md into the repository tree from any working directory, with no option chosen. The report quotes the game's executable, and the tree keeps such reports out of the repository.

This makes --out required. Every documented invocation and scripts/first_look.ps1:24 already pass it. A run without --out is one ERROR: line and exit 2, raised after the existing missing-input check so the BUILD-1046 contract for a missing input (one ERROR: <path>: does not exist line) is unchanged.

Test — python -I tests/test_pe_inspect.py, new case PeInspectTest.test_cli_requires_an_output_directory:

  • Before the change (same test file, old tool): FAILED (failures=1) — main() returns 0 and writes reports/pe/sample.dll.json and sample.dll.md into the checkout.
  • After: Ran 61 tests in 4.8s ... OK, and no reports/pe appears.
  • python -I tests/test_missing_input_exit_codes.py: Ran 2 tests in 1.7s ... OK.
  • python -m compileall -q tools/pe_inspect.py tests/test_pe_inspect.py: clean.

No GPU needed. No game files needed; the test builds its PE image by hand.

Notes

AI-assisted.

The default resolved reports/pe through __file__, so a run from any working directory wrote a report of the game's executable into the checkout (under an ignored folder, but still inside the repo tree). Every documented call and scripts/first_look.ps1 already pass --out, so the flag becomes required: a run without it is one ERROR line and exit 2.
Fails on main: main() returned 0 and wrote <tools>/../reports/pe/sample.dll.json and .md. Asserts the exit code, the ERROR line, and that no default report directory appears.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant