Repository navigation
rpf9dump: reject a missing or non-file source before creating the output folder (BUILD-1337) - #4636
MichaelL401 wants to merge 1 commit into
Conversation
Kam471
left a comment
There was a problem hiding this comment.
Checked 046de426 on Windows 11. tests/test_rpf9dump_exit_codes.py -> 3 skipped (requires a built rpf9dump (RPF9DUMP_DLL); no .NET SDK here), so the end-to-end exit code is not exercised on this host.
By inspection the change is the right place: File.Exists(src) is checked before baseName/output-folder creation, so a missing source or a directory now exits 2 with source is not a file: … instead of creating <out>/<name> and then throwing on FileInfo.Length. git diff --check clean. No blocking issue from the available evidence; it still needs the built-tool run.
|
Tested 046de42 merged with main 7b7d73f on native Windows 11 (.NET SDK 10.0.403 building the net8.0
|
…put folder A mistyped source path, or a directory passed as one, created <out>/<name> and then failed in FileInfo.Length with an unhandled FileNotFoundException and exit -532462766. Check the source after the argument checks and before Directory.CreateDirectory, print one line to stderr, and exit 2 like the other input errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
046de42 to
d42ce06
Compare
|
Tested d42ce06 merged with main 98fa503 on Linux (Python 3.12.16, dotnet SDK 8.0.428) and native Windows (Python 3.13.1, .NET SDK 10.0.403): pass. tests/test_rpf9dump_exit_codes.py with RPF9DUMP_DLL set to the rpf9dump.dll I had just built from the merged tree: 3 tests OK on both. Negative control: restored main's tools/rpf9dump/Program.cs, rebuilt, reran: 2 failures on Linux and 2 failures on Windows (the missing-source and directory-source subtests), then restored. Diff read; no issues found. |
|
Verified on Linux: merges cleanly into current main; the new File.Exists(src) check sits before any output-folder creation (Program.cs:34 vs :38), so the mistyped-path and directory-source cases exit 2 leaving the output untouched, exactly as the added test asserts. The C# binary is not buildable in this environment, so the gated test ran as the documented skip (RPF9DUMP_DLL unset) rather than executing — a CI run with a built rpf9dump is the remaining check. No CI checks reported on the branch. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claim: BUILD-1337, #4571 (comment)
What and why
rpf9dump <mode> <source> <out>with a mistyped source path, or with a folder passed as the source, created<out>/<name>/and then died innew FileInfo(src).Lengthwith an unhandledFileNotFoundException(exit -532462766 on Windows, 134 on Linux), leaving the empty output folder behind.tools/rpf9dump/Program.csnow checksFile.Exists(src)after the argument and--start/--lengthchecks and beforeDirectory.CreateDirectory, printssource is not a file: <path>to stderr and exits 2, like the other usage errors. Every mode (ttpf,models,textures, and the archive modes) reads the source as a file, so no mode that took a folder is affected.tests/test_rpf9dump_exit_codes.pygetstest_missing_or_directory_source_exits_2_before_the_output_folder_is_created: a missing source and a folder source each exit 2, name the problem on stderr, print no unhandled exception and create no output folder.Tests
Linux (Ubuntu 24.04), .NET SDK 8.0.134, Python 3.13, CPU only, no game files. rpf9dump built from this branch and from main
d0835dd9withdotnet build tools/rpf9dump/rpf9dump.csproj -c Release:RPF9DUMP_DLL=<branch build> python -I tests/test_rpf9dump_exit_codes.py -v: 3 tests OK.dotnet rpf9dump.dll ttpf ./missing.rpf ./outthrowsFileNotFoundExceptionatFileInfo.get_Length()(Program.cs:36) and leavesout/missing/. On this branch it printssource is not a file: …/missing.rpf, exits 2 and creates nothing.python -m compileall -qon the test file: OK.No GPU used.
AI-assisted: the fix and test were written with OpenCode (Qwen3.6-35B-A3B); build, tests and this PR with Claude (Opus 5.5).