Files: .. in a title path stops at the virtual drive's root #182
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/182"
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 Marvisak/VIctory. Originally posted by Maraco91 on 2026-11-24T01:12:45Z.
What
A title path with
..could name a file outside the host folder behind its virtual drive.translatehands a short path to the host as the host folder followed by the title's tail, unchanged. The host then resolves..against the host folder, which has a parent: with a drive overC:\data\title,X:\..\outside.binbecomesC:\data\title\..\outside.bin, andCreateFileWmakesC:\data\outside.bin. To the titleX:\is a drive root, where..stops: the path isX:\outside.bin(asC:\..\xisC:\xon the host). The same goes forX:\a\..\..\b,X:/../bandX:..\b.The long form already does this:
verbatim()resolves.and..itself and "..stops at the root" (the existing test checks/x/../../y). So today the same title path names different host files depending on whether root + tail reaches 248 characters.Now a tail with a
..part is resolved here in the short form too, with the same clean-up (moved out ofverbatim()intoparts(), unchanged), and written as the host folder plus the names left. A trailing separator is kept, andX:\..is the root (<root>\). Paths without a..part are passed on exactly as before,/and all. Paths given with\?\are untouched: after that prefix..is a name to the host too.I have not seen a title build such a path (I have no game files); this is from reading the code. Both drives a title writes through (
T:, persistent storage) and the package drive go through this function.Tested
Windows 11 Pro 10.0.26200, rustc 1.98.1 (
x86_64-pc-windows-msvc), no game data, no GPU involved.New unit test
parent_parts_stop_at_the_drive_root: mounts<temp>\title, callsCreateFileWonX:\..\outside.binand checks the file is in<temp>\titleand not in<temp>; then checkstranslateon seven paths (\..\,/../, drive-relative..\, several levels, with., a trailing separator, the bareX:\..). Controls in the same test:X:\a\..\b.binstill names<root>\b.bin, and names that merely contain dots (a..b,..c) are passed on unchanged.main(d2a4bae) + the test only:cargo test -p victory-hle --lib parent_partsfails:left the drive(the file was created in<temp>, beside the drive's folder).cargo test -p victory-hle --lib files::: 5 passed, 0 failed (the 4 existing files tests, among them the long-path ones that go throughverbatim(), and the new one).cargo clippy -p victory-hle --tests: nothing infiles.rs.rustfmt --check files.rs: nothing in the lines changed (one existing difference at theReadFileassertion inkernel_reads_reach_the_buffer).cargo xtask policy --staged: ok.Not tested: a title run.
Touches
translate/verbatimonly; #111 (narrow wrappers) and #133 (mount_at) change other parts of the file.AI-assisted (Claude Code); the tests above were run on the machine described.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T01:24:04Z.
Tested
1827532under Wine 11.22 + vkd3d-proton 3.1 on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build withcargo xwin ... --target x86_64-pc-windows-msvc -p victory-hleand a native Microsoftd3dcompiler_47: pass.victory_hle: 86 passed, 1 failed — the failure ismodules::net::tests::only_loopback_is_reachable(Wine lacksWSAConnectByList, as in #118), not this PR. The test this PR adds passes.No game data used.
Imported from Marvisak/VIctory. Originally posted by acetonahard-code on 2026-11-24T20:24:59Z.
Tested on Windows 11 with the repo toolchain, merged into current
main(ffe310e):cargo test -p victory-hlemainmain+ this PRmain,--all-featuresmain+ this PR,--all-featurescargo clippy --all-targets -- -D warnings, with and without--all-features: clean.cargo fmt --check: no new diffs from this PR (the ones it reports are already onmain).I didn't test with game data.
Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:21:14Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-hle/src/modules/files.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T13:35:38Z.
Rebased onto current
main(63bcca4) so this can move again: commit e466d53 onrebase/182-dotdot-63bcca4. The author is unchanged (Maraco91); only the committer differs.One conflict, in the test module only:
maingainedan_empty_root_is_the_current_directoryin the same place. Both tests are kept.Checked on this rebase:
cargo test -p victory-hle: 153 passed, 0 failed.cargo clippy -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.Behaviour, with the call path and the translation table in the test:
X:\..\outside.binviaCreateFileW<root>\outside.bin, nothing beside the drive folderX:\a\.\..\..\..\b\<root>\b\— the trailing separator survivesX:\a..b\..cX:\a\..\b.bin<root>\b.bin, still inside the driveThe trailing-separator case is the one the earlier bundle lost, so it is worth keeping in the table.
If you would rather keep your own branch, cherry-pick
e466d53and force-push; if you want, I can also push it straight ontofiles/dotdot-stops-at-drive-rootwhen you say it is fine. Git author and aCo-authored-by: andrewpozdnakov7-jpg <[email protected]>trailer if it is folded into another commit.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.