Repository navigation
Runtime: require exactly one CLI mode so --dry-run cannot run image code - #913
bobcatchris wants to merge 1 commit into
Conversation
d283d54 to
d116f0c
Compare
|
Heads-up: this is the third open PR for the same |
The parser only rejected the no-mode case, so --dry-run together with --run passed validation and the loader called the executable's entry point. The mode count is now checked before anything is mapped, with a ctest that asserts the usage exit code without needing an image. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
d116f0c to
ab5dadc
Compare
|
Closing as superseded by #902, which is the stronger fix: it extracts the parser into @kapitche thanks for the heads-up — one fix for #886 is better than three. AI-assisted. |
What
gta6rtonly rejected the case where no mode was given:So
gta6rt --dry-run --run <exe>passed validation,runstayed true, andloader.initialise()plus the executable's entry point ran — exactly what--dry-runpromises never to do ("no code from the mapped images runs",runtime/README.md).--dry-run --inithad the same problem.The parser now counts the modes and requires exactly one before anything is mapped:
A new
cli_modesctest runsgta6rtwith every conflicting pair (--dry-run --run,--dry-run --init,--init --run), with no mode, and with no image, and asserts the usage exit code 2. No fixture or game image is needed: the check happens before the image is opened, which is the point of the fix. The existing single-mode behaviour is untouched (--dry-run <image>still maps and reports;--runstill runs).Fixes #886.
Claimed as a new runtime item in #634: #634 (comment)
Testing
Windows 11 x64 build 26200, AMD Radeon RX 7900 XTX (RDNA3, gfx1100), driver 32.0.32015.7029 (Adrenalin 26.10.1, LLPC), Vulkan 1.4.359, MSVC from VS 2022,
RelWithDebInfo,scripts/build_runtime.ps1.mainat this PR's base.gta6rt --dry-run --run x.exe→ exit 2, usage on stderr (previously it proceeded toward loading/running).gta6rt --dry-run --init x.exe→ exit 2.ctest -R "cli_modes|loader|pe_loader|unimplemented"→ 6/6 passed, including the newcli_modes.cteston the same base: 32/33, with onlyd3d12_vulkan_devicefailing — pre-existing issue d3d12_vulkan_device: OPTIONS19.SupportedSampleCountsWithNoOutputs 0xf vs host 0x1d on AMD (RX 7900 XTX, Windows) #854, which also fails on unmodifiedmainon this machine.No game files were used. AI-assisted.