tools/int_hw_probe.py: harden realpath --json validation and --hw-arch/--group checks #2293
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2293"
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?
Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-26T12:53:07Z.
Claimed in the coordination issue as: INT-HW-PROBE-REALPATH-JSON-GUARD-AND-CLI-VALIDATION (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7192551919)
What and why
os.path.realpath(out_path)in_validate_json_out()(tools/int_hw_probe.py) so symlinked directories and non-directory ancestors along the resolved target are rejected withERROR:and exit code2before running translator or hardware probes.--hw-archupfront inmain(): reject empty--hw-archvalues and reject--hw-archwhen--oracle translatoris selected (exit code2).--groupentries withERROR: --group must not be emptyand exit code2.tests/test_int_hw_probe.py.Tested
python -I tests/test_int_hw_probe.py -v: 14 passed, 0 failed (detachedupstream/mainbaseline with only the updated test file fails with 6 failures).python -I tests/test_ci_registration.py: 16 passed.python -I tests/test_text_write_line_endings.py: 3 passed.python -I scripts/check_no_game_data.py,python -I -m compileall -q tools/int_hw_probe.py tests/test_int_hw_probe.py, andgit diff --cached --check: passed.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.Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-27T04:40:52Z.
Review: APPROVED
Approving
6a0a43449.The
--jsoncheck now looks at the resolved destination as well as the given path (a symlink into a file or a non-folder ancestor is refused), and an empty--hw-arch,--hw-archwith--oracle translator, and a blank--groupare usage errors.Merged onto
maind1dff7949in one batch with 15 other tool PRs of this series (no conflicts), on Linux with Python 3.13.tests/test_int_hw_probe.py: 14 passed (main: 13). AI-assisted (Claude Code, Claude Opus 5.5).Imported from ubiquitarianism/leonida. Originally posted by MSedgeMC on 2026-11-27T15:26:50Z.
Review: COMMENTED
Verified on the PR branch: python3 -m unittest tests.test_int_hw_probe -v -> 14 tests OK, including the new --json path/hardware-arg validation cases. Not approving yet: the branch is 446 commits behind current main, so a rebase is needed before the final diff can be reviewed.
Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:12:37Z.
#2293 | head
6a0a43449efd7b22db03c6999d2bd2bc8f86deb5|python3 -I tests/test_int_hw_probe.py -v| red: 14 run, 6 failures | green: 14 passed | Red → greenOn main the CLI proceeded to probe work or produced the wrong status for invalid arguments. These checks used the PR’s synthetic cases.
Pinned main
33db04a7010e81c40a7a6a15624525aa0c4a3a58, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T10:46:50Z.
Merged, thank you @kirigayakazima!
What it does: tools/int_hw_probe.py: harden realpath --json validation and --hw-arch/--group checks
How it was checked: sodove tested this PR at head
6a0a43449on main33db04a70: the PR's own test fails on main and passes with this PR merged in (his result is linked from the batch summary in #1608). We then re-ran the same test locally on Windows 11 and got the same verdict: on main, red (6 failures); with the PR, green (14 OK).CI: the red jobs on this PR fail the same way on main, or on the older main it was built on (the
cs_dpp_cmp.asmtranslator fixture, since fixed on main, and the Windows runner's Visual Studio setup), so none comes from this change.Merged one by one with 20 other PRs of the same reviewed batch, pinned to the tested head.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.