runtime: harden bink_frame_aot CLI with atomic writes and add CLI suite #2680
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2688"
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 R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-26T02:04:42Z.
Change
Harden CLI path validation and atomic output writing in
tools/bink_frame_aot.pyand add a pure-Python CLI suite (tests/bink_frame_aot_cli_check.py), registered inCMakeLists.txtasruntime_bink_frame_aot_cli_check._validate_args()thatimageexists and is a regular file (not a directory), and thatoutputhas a.cppsuffix, is not a symlink, directory, under a non-directory parent/ancestor, orresolve()/samefile()equal toimagebefore callinggenerate().write_text()with sibling-temp_write_atomic()creating missing parent directories and unlinking temp files on all errors, while preserving clean stderr output and non-zero exit codes with zero raw tracebacks.generate()behavior andtests/bink_frame_aot_check.pyunchanged.Verification
Verified on commit
332b627b(based onupstream/main572723f9) on Windows usingout/pe-env/Scripts/python.exe -B:out\pe-env\Scripts\python.exe -B tests\bink_frame_aot_check.py-> exit 0 (7/7 OK).out\pe-env\Scripts\python.exe -B tests\bink_frame_aot_cli_check.py-> exit 0 (7/7 tests OK, 0 skips: atomic.cppin nested dirs & overwrite with 0.tmp,argv=None/__main__, missing/dir/corrupt/unmatched-hash image, output dir/symlink/file-parent/samefile/hardlink/non-.cppguards,os.replacefailure preserving target bytes, Python 3.14-safe argparse checks, and 4 fast in-memory mutations).out\pe-env\Scripts\python.exe -B tests\form_coverage_check.py,tests\docs_links_check.py,tests\bidi_controls_check.py-> all exit 0.tests/bink_frame_aot_cli_check.py): disablingoutput.is_symlink()guard, disablingsamefile()hardlink collision check, and disabling.tmpunlink cleanup on replace failure.Evidence and follow-up
generate()output in temporary directories (MIT License; no game files or binaries).Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:26:18Z.
Review: COMMENTED
Review of head
786f3aff(after update with main).Looks sound. Args are validated before generate(), output is written through a sibling temp file and replaced atomically, temp files are removed on error, and exit codes/messages stay clean. generate() is unchanged. The new runtime_bink_frame_aot_cli_check test is registered next to bink_frame_aot_check. #1968 (merged) covers anchor validation only; no other open PR covers this CLI slice.
Commands run (Linux):
Minor note, not blocking: output is now written with newline="\n", so files on Windows no longer get CRLF. Harmless for a compiled .cpp.
Windows WARP run follows separately.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:45:40Z.
Win2025 WARP receipt for head
786f3affafter updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
786f3aff28f37ca59bbb583682677802f9083431:--preset dev):cmake --build --preset dev -- -j 2):542.00s(configure4.13s)ctest --preset dev -R 'bink_frame_aot' --parallel 6 --no-tests=error --output-on-failure): 2/2 passed (6.45s:bink_frame_aot_check2.34s,runtime_bink_frame_aot_cli_check6.29s)/O2(--preset release):cmake --build --preset release -- -j 2):580.39s(configure4.42s)ctest --preset release -R 'bink_frame_aot' --parallel 6 --no-tests=error --output-on-failure): 2/2 passed (5.14s:bink_frame_aot_check1.98s,runtime_bink_frame_aot_cli_check5.03s)sccache: 36/2447 hits; wall1148.4sAI-assisted; commands listed were executed locally.