Repository navigation
image_fuzz: reject a --work that is a file before the fuzz starts - #4087
tupacfan04 wants to merge 2 commits into
Conversation
A --work pointing at a file (or under one) reached os.makedirs after the cases were built and died with a raw FileExistsError traceback. Validate the destination (or its nearest existing parent) right after the argument checks, so it is one ERROR line and exit 2 before any work.
|
Second check on Windows at 4d3280e. With case generation and translation mocked, the base reached case generation and then raised a filesystem exception for both a regular file and a nested path beneath it. This head returned 2 with one --work diagnostic, before either mock was called, and preserved the file bytes. A new directory below an existing directory and the default scratch directory each reached the stub driver once and returned 0 on both revisions. No fuzz or native tool was launched. AI-assisted. |
|
Tested
AI-assisted. The Vulkan backend was stubbed. No GPU or game files were used. |
TG0000
left a comment
There was a problem hiding this comment.
Tested 4d3280e9 on Windows 11 build 26300 with CPython 3.12.10. The 63 tests in tests/test_image_fuzz.py pass with pytest 9.2.0.
A dangling NTFS directory junction supplied as --work still reaches make_cases and then raises FileExistsError. A child path under the junction raises FileNotFoundError after case generation. exists() skips the dangling junction during preflight. Changing both os.path.exists(probe) checks to os.path.lexists(probe) returned 2 with a single --work diagnostic before make_cases in both cases. Retested all seven paths: regular file, its child, dangling junction, its child, live junction, its child, and a new nested directory. The original file and junction stayed intact, and valid directories were accepted.
AI-assisted (OpenAI Codex). Case generation and the Vulkan runner were mocked. Synthetic paths only.
|
Verified on Linux: merges cleanly into main (aa2988c), |
Use lexists for the destination probe, so a dangling symlink or junction is reported as "not a folder" instead of being treated as missing and failing in makedirs. Strip the BOM and trailing blank line from the new test file, and add a symlink case that skips where symlinks cannot be created.
|
Addressed the two post-review points in
Re-checked: AI-assisted, no game files, no GPU. |
|
Closing as superseded.
Because Thanks to the auditors for spotting the overlap before it wasted a rebase. AI-assisted, no game files. |
Claimed in the coordination issue as: new
BUILDitem (claim).What and why
tools/image_fuzz.py --work <a file>reachedos.makedirs(work, exist_ok=True)aftermake_cases()had built every case, and died with a rawFileExistsErrortraceback. The same happened for a--workunder a regular file.ERROR: --work is not a folder: <path>line on stderr and exit 2, before any fuzz work.--workunder a real folder is still accepted, as is the default temp directory.make_game --out/--work); BUILD-1073: isolate image fuzzer work output #3770's per-run isolation is untouched.Tested
tests/test_image_fuzz.py: 63 passed, including two new cases (--workis a file;--workunder a file), each asserting exit 2, the message, no traceback, and that the existing file's contents are unchanged.origin/main(aa2988cc) fails exactly those two, 61 passed.python -m compileall -q tools/image_fuzz.py tests/test_image_fuzz.py.AI-assisted: written by an AI coding agent (OpenCode) and checked by the commands above.
Checklist
CONTRIBUTING.md), including in logs or reports quoted here.docs/design.md, with how it was confirmed. (Not a translator change.)Depends on: #3770 (same
--worklines; whichever lands second needs a trivial rebase).