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

Closed
towiice wants to merge 1 commit from upstream-pr/339 into main
towiice commented 2026-11-24 23:36:59 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by towiice on 2026-11-24T23:36:59Z.


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.
<!-- greyfinch-sync:fxceless/victory-fork:issue:6593629061 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/339). Originally posted by [towiice](https://github.com/towiice) on 2026-11-24T23:36:59Z. --- 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.
kaayzouee commented 2026-11-25 01:11:59 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by kaayzouee on 2026-11-25T00:24:24Z.


Duplicate of #322?

<!-- greyfinch-sync:fxceless/victory-fork:comment:7148476013 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/339#issuecomment-7148476013). Originally posted by [kaayzouee](https://github.com/kaayzouee) on 2026-11-25T00:24:24Z. --- Duplicate of #322?
upstream-sync closed this pull request 2026-11-25 02:09:27 +00:00
towiice commented 2026-11-25 02:10:14 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by towiice on 2026-11-25T02:01:50Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:comment:7150235953 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/339#issuecomment-7150235953). Originally posted by [towiice](https://github.com/towiice) on 2026-11-25T02:01:50Z. --- Closing: #322 and #327 were opened for #242 before this one. Sorry for the noise.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!339
No description provided.