Reject persistent data directories inside the cache #194

Open
feanorsun wants to merge 2 commits from upstream-pr/194 into main
feanorsun commented 2026-11-26 11:11:14 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by feanorsun on 2026-11-26T11:11:14Z.


Persistent saves can be lost when a user clears the cache. This change checks the final data_dir and cache_dir after each setting has been resolved from the environment, the configuration file, or its default. It rejects equality and descendants. Siblings such as cache and cache-old, and a cache below the data directory, remain valid.

The first commit is an independent port of Luiz Neves's original patch, cherry-picked with -x from c7cf0baafc1cd3f465ae7a4208758c8423fafd71. The same configuration change appeared in the closed upstream PR #103. Original PR and diff · Upstream PR #103

The follow-up covers both directions of a VICTORY_DATA_DIR override. For directories that do not exist yet, it applies Win32 path spelling rules, preserves explicit verbatim paths, and checks the parent directory's case-sensitivity setting when the two spellings differ only in case. The Windows bindings were already in the workspace lockfile.

Windows verification

cargo test --locked -j 1 -p victory-core --lib config::tests:: -- --list
cargo test --locked -j 1 -p victory-core --lib config::tests:: -- --test-threads=1
git diff --check upstream/main...HEAD
  • On upstream main with the environment regression added, 8 tests passed and 1 failed. An override to cache\saves returned a successful configuration.
  • With the original port, the override test passed. A Windows test still reproduced a case-only alias for a missing cache directory on this machine's case-insensitive filesystem. That run had 12 passes and 1 failure.
  • The final filter listed 14 tests. All 14 passed, with 5 filtered out. Coverage includes directories that do not exist yet, .. paths, overrides into and out of the cache, similarly named siblings, and ordinary versus verbatim Windows paths.

Cargo used local dependencies offline. The regressions used temporary directories and injected environment values. Validation was limited to CPU configuration tests.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:5508947066 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/194). Originally posted by [feanorsun](https://github.com/feanorsun) on 2026-11-26T11:11:14Z. --- Persistent saves can be lost when a user clears the cache. This change checks the final `data_dir` and `cache_dir` after each setting has been resolved from the environment, the configuration file, or its default. It rejects equality and descendants. Siblings such as `cache` and `cache-old`, and a cache below the data directory, remain valid. The first commit is an independent port of Luiz Neves's original patch, cherry-picked with `-x` from `c7cf0baafc1cd3f465ae7a4208758c8423fafd71`. The same configuration change appeared in the closed upstream PR #103. [Original PR and diff](https://github.com/uiliannn/VItoriaBr/pull/42/files) · [Upstream PR #103](https://github.com/avatarmanz/VIctory-7900XTX/pull/103) The follow-up covers both directions of a `VICTORY_DATA_DIR` override. For directories that do not exist yet, it applies Win32 path spelling rules, preserves explicit verbatim paths, and checks the parent directory's case-sensitivity setting when the two spellings differ only in case. The Windows bindings were already in the workspace lockfile. ### Windows verification ```powershell cargo test --locked -j 1 -p victory-core --lib config::tests:: -- --list cargo test --locked -j 1 -p victory-core --lib config::tests:: -- --test-threads=1 git diff --check upstream/main...HEAD ``` - On upstream main with the environment regression added, 8 tests passed and 1 failed. An override to `cache\saves` returned a successful configuration. - With the original port, the override test passed. A Windows test still reproduced a case-only alias for a missing cache directory on this machine's case-insensitive filesystem. That run had 12 passes and 1 failure. - The final filter listed 14 tests. All 14 passed, with 5 filtered out. Coverage includes directories that do not exist yet, `..` paths, overrides into and out of the cache, similarly named siblings, and ordinary versus verbatim Windows paths. Cargo used local dependencies offline. The regressions used temporary directories and injected environment values. Validation was limited to CPU configuration tests.
kilolimaVI commented 2026-11-26 19:16:23 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by kilolimaVI on 2026-11-26T19:16:23Z.


Tested locally on Windows 11 (Ryzen 7 8845HS / Radeon 780M, pinned toolchain 1.98.1):

  • cargo test -p victory-core --locked: 19 passed, 0 failed (includes the six new data/cache directory tests)
  • cargo clippy -p victory-core --all-targets --all-features --locked -- -D warnings: clean
  • Cargo.lock change resolves with --locked

Branch is 14 commits behind main; tested as-is.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7201393824 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/194#issuecomment-7201393824). Originally posted by [kilolimaVI](https://github.com/kilolimaVI) on 2026-11-26T19:16:23Z. --- Tested locally on Windows 11 (Ryzen 7 8845HS / Radeon 780M, pinned toolchain 1.98.1): - `cargo test -p victory-core --locked`: 19 passed, 0 failed (includes the six new data/cache directory tests) - `cargo clippy -p victory-core --all-targets --all-features --locked -- -D warnings`: clean - `Cargo.lock` change resolves with `--locked` Branch is 14 commits behind main; tested as-is.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/194:upstream-pr/194'
git switch 'upstream-pr/194'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/194'
git switch 'upstream-pr/194'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/194'
git switch 'upstream-pr/194'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/194'
git switch 'main'
git merge --squash 'upstream-pr/194'
git switch 'main'
git merge --ff-only 'upstream-pr/194'
git switch 'main'
git merge 'upstream-pr/194'
git push origin 'main'
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
avatarmanz/VIctory-7900XTX!194
No description provided.