Files: .. on a virtual drive stops at its root in short paths too (G:\..\x left the package folder) #258

Open
sharan104 wants to merge 1 commit from upstream-pr/258 into main
sharan104 commented 2026-11-26 13:32:25 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by sharan104 on 2026-11-26T13:32:25Z.


A virtual drive's root is the root of a drive to the title, so X:\.. is X:\ again. translate() already handles this for long paths: anything of 248 characters or more goes through verbatim(), which stops .. at the root. But a short path was joined to the host folder as it came, and the host's own clean-up then climbed above that folder. So:

  • G:\..\x opened x beside the package folder instead of G:\x.
  • .. from the persistent-storage drive reached the data directory around the title's storage folder.
  • The same title path landed in different folders depending on its length.

This affects every title path call that goes through translate(): CreateFileW, fopen, GetFileAttributesW and the rest.

Fix: a short path now drops each .. that would climb above the root (within_root) before the host sees it. Everything else is still left to the host's clean-up, as before. \\?\ paths, which the host doesn't clean up, are unchanged.

Only an exact .. component climbs. I checked GetFullPathNameW on Windows 11: .. , ..., .. . and .. are kept as literal names, or trimmed when they're the last part, and none of them goes up a level. So matching exactly .. covers every spelling that climbs.

Test: dot_dot_stays_on_the_drive checks the rewritten strings. It also checks real GetFileAttributesW calls against a mounted temp folder: X:\..\outside.txt is not found, while X:\..\inside.txt and X:/a/../../inside.txt are found. It fails before the change, where the host path keeps inner\..\a, and passes after it.

Results:

  • cargo test -p victory-hle --locked: 156 passed, 0 failed, 2 ignored. The new test passed 10 out of 10 runs.
  • cargo clippy -p victory-hle --all-targets --locked --no-deps -- -D warnings is clean, with and without --all-features.

🤖 Generated with Claude Code

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6627761000 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/258). Originally posted by [sharan104](https://github.com/sharan104) on 2026-11-26T13:32:25Z. --- A virtual drive's root is the root of a drive to the title, so `X:\..` is `X:\` again. `translate()` already handles this for long paths: anything of 248 characters or more goes through `verbatim()`, which stops `..` at the root. But a **short** path was joined to the host folder as it came, and the host's own clean-up then climbed above that folder. So: - `G:\..\x` opened `x` beside the package folder instead of `G:\x`. - `..` from the persistent-storage drive reached the data directory around the title's storage folder. - The same title path landed in different folders depending on its length. This affects every title path call that goes through `translate()`: `CreateFileW`, `fopen`, `GetFileAttributesW` and the rest. **Fix:** a short path now drops each `..` that would climb above the root (`within_root`) before the host sees it. Everything else is still left to the host's clean-up, as before. `\\?\` paths, which the host doesn't clean up, are unchanged. Only an exact `..` component climbs. I checked `GetFullPathNameW` on Windows 11: `.. `, `...`, `.. .` and `.. ` are kept as literal names, or trimmed when they're the last part, and none of them goes up a level. So matching exactly `..` covers every spelling that climbs. **Test:** `dot_dot_stays_on_the_drive` checks the rewritten strings. It also checks real `GetFileAttributesW` calls against a mounted temp folder: `X:\..\outside.txt` is not found, while `X:\..\inside.txt` and `X:/a/../../inside.txt` are found. It fails before the change, where the host path keeps `inner\..\a`, and passes after it. **Results:** - `cargo test -p victory-hle --locked`: 156 passed, 0 failed, 2 ignored. The new test passed 10 out of 10 runs. - `cargo clippy -p victory-hle --all-targets --locked --no-deps -- -D warnings` is clean, with and without `--all-features`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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/258:upstream-pr/258'
git switch 'upstream-pr/258'

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/258'
git switch 'upstream-pr/258'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/258'
git switch 'upstream-pr/258'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/258'
git switch 'main'
git merge --squash 'upstream-pr/258'
git switch 'main'
git merge --ff-only 'upstream-pr/258'
git switch 'main'
git merge 'upstream-pr/258'
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!258
No description provided.