Skip to content

saves: preserve input containers during extraction - #7404

Open
waskronos wants to merge 1 commit into
ItsNotRexed:mainfrom
waskronos:codex/saves-extract-source-guard
Open

waskronos wants to merge 1 commit into
ItsNotRexed:mainfrom
waskronos:codex/saves-extract-source-guard

Conversation

@waskronos

Copy link
Copy Markdown

Claim: #7333 (comment)

saves.py extract could overwrite its input when a generated output filename named the source container, including through a hard link or symlink.

Check all generated JSAV and ASAV output paths using the shared same_report_path helper before writing extraction files. Refused runs preserve the source and existing exports.

Regression coverage includes direct filename collisions, hard links, symlinks where available, Windows case aliases, optional ASAV outputs, CLI errors, and successful extraction into another directory.

Validation on Windows, Python 3.14.6:

  • python -I tests/test_saves.py: 77 tests, OK, 5 skipped.
  • Changed-file no-game-data check and git diff --check: passed.
  • Full repository CI, runtime and translator suites were not run.

Related: #1438 checks the destination directory; #6823 and #5107 protect pack sources. This change protects the extract input.

AI-assisted (OpenAI Codex helped). Synthetic fixtures only; CPU only, no GPU testing or game files.

@slint6614-dev

Copy link
Copy Markdown
Contributor

Checked on Linux: merged onto main 77fa308 (merges cleanly).

  • python3 -B tests/test_saves.py → OK
  • Negative control: with tools/saves.py reverted to main and the new test kept, 15 tests fail, so the test catches the bug.
  • 2 tests are skipped on Linux (platform-specific), so those were not exercised here.
    Read the diff as well; it looks right to me.

@airp1ane

Copy link
Copy Markdown
Contributor

Tested 3e2978f on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass.

Ran the test files this PR adds or changes, from a clean checkout of the PR head: test_saves.py - all exit 0.

AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants