HLE: abort xgamesave legacy container migration if any blob read fails #339

Closed
github-bot wants to merge 1 commit from gh-pr/339/head into gh-pr/339/base
Owner

@⁠towiice on GitHub · 2026-11-24 23:36 UTC · original
towiice:fix/xgamesave-migrate-unreadable-blob → main · +47 −8 · 1 files · 1 commits · closed without merging

Fixes #242.

migrate in crates/victory-hle/src/modules/xgamesave.rs read the old layout's blobs inside a filter_map, so a blob that failed to read (a sharing violation, a locked file, a bad directory entry) was silently left out. The partial set was then committed as version 1 and remove_dir_all(old) deleted the original, so that blob was lost for good.

What is in it

  • migrate now loops over the directory and returns None if a directory entry or the read of any file whose name decodes as a blob fails. Nothing is committed and old stays in place, so the next Provider::open tries again. Files that are not blobs (.display, *.new) are skipped as before.
  • Test migration_aborts_without_deleting_old_when_a_blob_cannot_be_read: a directory with a blob name makes the read fail; migration leaves old and commits nothing. Once the entry is a readable file, migration succeeds with both blobs.

Tested

  • GTX 1650 SUPER, Windows 11, Rust 1.100.0 x86_64-pc-windows-gnullvm, debug.
  • cargo test -p victory-hle --lib xgamesave: 8 passed, 0 failed (the 7 existing tests and the new one).

Not tested

  • A real sharing violation or locked file (the test uses a directory to make the read fail), the MSVC toolchain, the full workspace suite, Clippy, a game.

AI use

  • Written with an AI assistant (Antigravity); I read the change and ran the tests above.
**@⁠towiice** on GitHub · 2026-11-24 23:36 UTC · [original](https://github.com/fxceless/victory-fork/pull/339) `towiice:fix/xgamesave-migrate-unreadable-blob` → `main` · +47 −8 · 1 files · 1 commits · closed without merging Fixes #242. `migrate` in `crates/victory-hle/src/modules/xgamesave.rs` read the old layout's blobs inside a `filter_map`, so a blob that failed to read (a sharing violation, a locked file, a bad directory entry) was silently left out. The partial set was then committed as version 1 and `remove_dir_all(old)` deleted the original, so that blob was lost for good. **What is in it** - `migrate` now loops over the directory and returns `None` if a directory entry or the read of any file whose name decodes as a blob fails. Nothing is committed and `old` stays in place, so the next `Provider::open` tries again. Files that are not blobs (`.display`, `*.new`) are skipped as before. - Test `migration_aborts_without_deleting_old_when_a_blob_cannot_be_read`: a directory with a blob name makes the read fail; migration leaves `old` and commits nothing. Once the entry is a readable file, migration succeeds with both blobs. **Tested** - GTX 1650 SUPER, Windows 11, Rust 1.100.0 `x86_64-pc-windows-gnullvm`, debug. - `cargo test -p victory-hle --lib xgamesave`: 8 passed, 0 failed (the 7 existing tests and the new one). **Not tested** - A real sharing violation or locked file (the test uses a directory to make the read fail), the MSVC toolchain, the full workspace suite, Clippy, a game. **AI use** - Written with an AI assistant (Antigravity); I read the change and ran the tests above.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:41:08 +00:00
github-bot closed this pull request 2026-11-26 03:41:08 +00:00
Author
Owner

@⁠kaayzouee on GitHub · 2026-11-25 00:24 UTC · original

Duplicate of #322?

**@⁠kaayzouee** on GitHub · 2026-11-25 00:24 UTC · [original](https://github.com/fxceless/victory-fork/pull/339#issuecomment-7148476013) Duplicate of #322?
Author
Owner

@⁠towiice on GitHub · 2026-11-25 02:01 UTC · original

Closing: #322 and #327 were opened for #242 before this one. Sorry for the noise.

**@⁠towiice** on GitHub · 2026-11-25 02:01 UTC · [original](https://github.com/fxceless/victory-fork/pull/339#issuecomment-7150235953) Closing: #322 and #327 were opened for #242 before this one. Sorry for the noise.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.