rpf_probe: write non-regular --out directly, guard empty/trailing-sep paths, enforce strict JSON (RPF-PROBE-NONREG-AND-OUT-GUARDS) #1593

Open
github-bot wants to merge 1 commit from github-bot/gh-1593 into main AGit
Owner

@⁠IlyassRS3 on GitHub · 2026-11-25 05:28 UTC · original
IlyassRS3:fix/rpf-probe-nonreg-and-out-guards → main · +61 −8 · 2 files · 1 commits · open

Item: RPF-PROBE-NONREG-AND-OUT-GUARDS (unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touch tools/rpf_probe.py).

Summary

  • Fix _write_json_report()'s non-regular destination branch: os.stat("/dev/null") succeeds with a character-device mode rather than raising OSError, so checking not stat.S_ISREG(mode) actually takes the direct-write path for /dev/null and pipes instead of attempting to stage a temp file in /dev and replace /dev/null.
  • Reject empty/whitespace game_dir or --out and trailing-separator --out directory paths before scanning archives (previously --out " " created a whitespace-named file in cwd and --out new_folder/ wrote a regular file named new_folder).
  • Enforce allow_nan=False and a trailing \n on written JSON reports, avoid computing entropy(body) twice per archive in probe(), and accept optional argv=None in main().

Verification

  • python3 -W error -I tests/test_rpf_probe.py -v: 33/33 passed.
  • python3 -I tests/test_text_write_line_endings.py: 3/3 passed.
  • python3 -I scripts/check_no_game_data.py tools/rpf_probe.py tests/test_rpf_probe.py: passed.
  • python3 -m compileall -q tools/rpf_probe.py tests/test_rpf_probe.py: passed.
  • Mutation check (running tests/test_rpf_probe.py against unpatched main:tools/rpf_probe.py): failures=6, errors=0 across all 3 new regression tests.

AI-assisted: yes
GPUs tested: none (CPU-only Python archive header survey tool; synthetic headers only, no game data)

**@⁠IlyassRS3** on GitHub · 2026-11-25 05:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1593) `IlyassRS3:fix/rpf-probe-nonreg-and-out-guards` → `main` · +61 −8 · 2 files · 1 commits · open Item: `RPF-PROBE-NONREG-AND-OUT-GUARDS` (unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touch `tools/rpf_probe.py`). ### Summary - Fix `_write_json_report()`'s non-regular destination branch: `os.stat("/dev/null")` succeeds with a character-device mode rather than raising `OSError`, so checking `not stat.S_ISREG(mode)` actually takes the direct-write path for `/dev/null` and pipes instead of attempting to stage a temp file in `/dev` and replace `/dev/null`. - Reject empty/whitespace `game_dir` or `--out` and trailing-separator `--out` directory paths before scanning archives (previously `--out " "` created a whitespace-named file in `cwd` and `--out new_folder/` wrote a regular file named `new_folder`). - Enforce `allow_nan=False` and a trailing `\n` on written JSON reports, avoid computing `entropy(body)` twice per archive in `probe()`, and accept optional `argv=None` in `main()`. ### Verification - `python3 -W error -I tests/test_rpf_probe.py -v`: 33/33 passed. - `python3 -I tests/test_text_write_line_endings.py`: 3/3 passed. - `python3 -I scripts/check_no_game_data.py tools/rpf_probe.py tests/test_rpf_probe.py`: passed. - `python3 -m compileall -q tools/rpf_probe.py tests/test_rpf_probe.py`: passed. - Mutation check (running `tests/test_rpf_probe.py` against unpatched `main:tools/rpf_probe.py`): `failures=6, errors=0` across all 3 new regression tests. AI-assisted: yes GPUs tested: none (CPU-only Python archive header survey tool; synthetic headers only, no game data)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:57:30 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 05:28 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-25 05:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1593#pullrequestreview-6052299487) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1593/head:github-bot/gh-1593'
git switch 'github-bot/gh-1593'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1593'
git switch 'github-bot/gh-1593'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1593'
git switch 'github-bot/gh-1593'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1593'
git switch 'main'
git merge --squash 'github-bot/gh-1593'
git switch 'main'
git merge --ff-only 'github-bot/gh-1593'
git switch 'main'
git merge 'github-bot/gh-1593'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.