HLE/files: a title path's ".." stops at the mounted drive's root #1444
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1444"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from fxceless/victory-fork. Originally posted by CwWwWwW on 2026-11-27T08:39:21Z.
Problem
The
victory-hlefilesmodule maps a host folder to a virtual drive and rewrites the title's path onto it (translate). For a short path the title's tail is appended to the mount's host folder unchanged, and the host's own path clean-up then resolves..against the host volume's root, not against the mount root. A title path with more..than its depth therefore leaves the folder the drive stands for:X:\..\..\save.binis written beside the mount instead of at its root, where the title will not find it again (and another folder of the host can be hit).The console clamps
..at the drive's root, and this layer's own\\?\branch for long paths (verbatim) already does that, so the short branch contradicted both.Fix
Resolve
.and..in the title's tail with the mount root as the floor, and only when the path names such a component: every other path keeps its exact form and the host's clean-up.X:andX:namestay relative to the root, a trailing separator is kept, and the\\?\-prefixed form gets the same treatment.Regression test
files::tests::dots_stop_at_the_mounted_rootmounts a temp folder as a drive and checks thatX:\a\..\..\b.txtresolves inside the mount, then writes throughX:\..\escaped.bin: with the old code the file is created beside the mount root (the test fails: left...\storage\a\..\..\b.txt) and with the change it stays in the folder.Verification
cargo test -p victory-hle --lib --locked: 104 passed, 0 failedcargo clippy -p victory-hle --all-targets --locked -- -D warnings: cleancrates/victory-hle/src/modules/files.rs(+78)Found and fixed independently in this tree; no external code was used.
The PR's Clippy check fails on main already: at
9a9091dcargo clippy --workspace --all-targetsfails invictory-shader(wave64_after_loop.rs precedence, valu_tests.rs simplifiable/negated partial-ord comparisons); open PR #1440 fixes exactly those lints. This diff touches none of those files, and the touched crate's own tests and clippy are clean locally.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.