HLE: clean dot parts in extended virtual-drive paths #421

Closed
github-bot wants to merge 1 commit from gh-pr/421/head into gh-pr/421/base
Owner

@⁠enzoduarte1 on GitHub · 2026-11-24 03:12 UTC · original
enzoduarte1:hle/verbatim-tail-normalization → main · +34 −17 · 1 files · 1 commits · closed without merging

What

translate() only called verbatim() when the title omitted \\?\ and the path was long. A short path that already had the prefix, such as \\?\G:/a/./b/../f.txt, had only / replaced by \: . and .. were passed through literally.

That form disables Win32 path cleanup on the host, so those components become real directory names and the file lands in the wrong place (or nowhere). Extended-prefix paths now go through the same cleaning helper as long paths, which resolves . and .. against the virtual drive root. A new test covers dot parts, a bare drive root, a relative tail and a plain extended path.

This complements PR #182, which handles .. in paths without the extended prefix; it does not change that branch's behavior.

Tested

  • Windows 11, Rust 1.98.1, x86_64-pc-windows-gnu (no MSVC linker on this machine).
  • cargo test -p victory-hle --lib files::: 5 passed.
  • cargo test --workspace --exclude victory-loader -- --test-threads=1: all suites passed.
  • cargo clippy -p victory-hle --all-targets -- -A clippy::field_reassign_with_default -D warnings: clean. The allowed lint is the pre-existing warning fixed by PR #355.
  • git diff --check: clean. rustfmt --check passes except for one unrelated pre-existing line in this file; that line was left untouched to keep the diff focused.
  • cargo xtask policy: 151 files ok. No game files or data taken from them were added.
  • Not tested: cargo test -p victory-loader --test load_probe. Its fixture passes MSVC's /DELAYLOAD flag, which MinGW rejects here; the same failure occurs on unmodified main.

Checklist

  • cargo fmt, cargo clippy --workspace --all-targets and cargo test --workspace pass — see the toolchain limitations above; the changed crate is clean.
  • cargo xtask policy passes. The change adds no game files or data taken from them (docs/asset-policy.md).
  • If an AI tool wrote part of this change, the description says so: an AI tool assisted with the code and test; I reviewed and ran them.
**@⁠enzoduarte1** on GitHub · 2026-11-24 03:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/421) `enzoduarte1:hle/verbatim-tail-normalization` → `main` · +34 −17 · 1 files · 1 commits · closed without merging ## What `translate()` only called `verbatim()` when the title omitted `\\?\` and the path was long. A short path that already had the prefix, such as `\\?\G:/a/./b/../f.txt`, had only `/` replaced by `\`: `.` and `..` were passed through literally. That form disables Win32 path cleanup on the host, so those components become real directory names and the file lands in the wrong place (or nowhere). Extended-prefix paths now go through the same cleaning helper as long paths, which resolves `.` and `..` against the virtual drive root. A new test covers dot parts, a bare drive root, a relative tail and a plain extended path. This complements PR #182, which handles `..` in paths *without* the extended prefix; it does not change that branch's behavior. ## Tested - Windows 11, Rust 1.98.1, `x86_64-pc-windows-gnu` (no MSVC linker on this machine). - `cargo test -p victory-hle --lib files::`: 5 passed. - `cargo test --workspace --exclude victory-loader -- --test-threads=1`: all suites passed. - `cargo clippy -p victory-hle --all-targets -- -A clippy::field_reassign_with_default -D warnings`: clean. The allowed lint is the pre-existing warning fixed by PR #355. - `git diff --check`: clean. `rustfmt --check` passes except for one unrelated pre-existing line in this file; that line was left untouched to keep the diff focused. - `cargo xtask policy`: 151 files ok. No game files or data taken from them were added. - Not tested: `cargo test -p victory-loader --test load_probe`. Its fixture passes MSVC's `/DELAYLOAD` flag, which MinGW rejects here; the same failure occurs on unmodified `main`. ## Checklist - [ ] `cargo fmt`, `cargo clippy --workspace --all-targets` and `cargo test --workspace` pass — see the toolchain limitations above; the changed crate is clean. - [x] `cargo xtask policy` passes. The change adds no game files or data taken from them (`docs/asset-policy.md`). - [x] If an AI tool wrote part of this change, the description says so: an AI tool assisted with the code and test; I reviewed and ran them.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:03:15 +00:00
github-bot closed this pull request 2026-11-26 04:03:15 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:40 UTC · original

Thanks @⁠enzoduarte1 for applying path cleanup to already-prefixed virtual-drive paths. I tested head 1d0f48a93f04dde16dd9d414737254739f1800b6 with:

cargo test --locked -p victory-hle --lib files:: -- --test-threads=1

Result: 5 passed, 0 failed (82 filtered out). The tests include extended-path dot-part cleanup and cover mounted-drive rewriting, long paths, title file calls, and reads into the supplied buffer. These are synthetic HLE file/path tests, not a title file workflow.

**@⁠jeremygold02** on GitHub · 2026-11-24 04:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/421#issuecomment-7122236488) Thanks @⁠enzoduarte1 for applying path cleanup to already-prefixed virtual-drive paths. I tested head `1d0f48a93f04dde16dd9d414737254739f1800b6` with: ``` cargo test --locked -p victory-hle --lib files:: -- --test-threads=1 ``` Result: 5 passed, 0 failed (82 filtered out). The tests include extended-path dot-part cleanup and cover mounted-drive rewriting, long paths, title file calls, and reads into the supplied buffer. These are synthetic HLE file/path tests, not a title file workflow.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:29 UTC · original

Automated triage for the maintainers.

Merge candidate. translate in crates/victory-hle/src/modules/files.rs now sends paths that already have the \\?\ prefix through verbatim(), the helper used for long paths. With that prefix the host does no clean-up, so . and .. used to reach the filesystem as literal names; it also fixes a UNC drive root and a root that already had the prefix (which was doubled). The empty-tail, X:name and plain cases check out against verbatim(), the non-prefixed branch is unchanged, and the new test covers each case.

CI: check passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/421#issuecomment-7148557562) <!-- victory-triage v1 head=83b2037e40ea3fe2990f9aac88f46afa0b77c84d verdict=merge-candidate at=2026-11-25T00:22:34Z --> Automated triage for the maintainers. **Merge candidate.** `translate` in `crates/victory-hle/src/modules/files.rs` now sends paths that already have the `\\?\` prefix through `verbatim()`, the helper used for long paths. With that prefix the host does no clean-up, so `.` and `..` used to reach the filesystem as literal names; it also fixes a UNC drive root and a root that already had the prefix (which was doubled). The empty-tail, `X:name` and plain cases check out against `verbatim()`, the non-prefixed branch is unchanged, and the new test covers each case. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 21:58 UTC · original

Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing as a subset of #1772, which makes the same change to translate (any \\?\ title path goes through verbatim()) and covers more: \\?\ host roots, drive-root mounts and GetDiskFreeSpaceW volume roots. The two conflict in files.rs, and the only difference left here is a trailing backslash that names the same folder either way.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 21:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/421#issuecomment-7175783092) Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing as a subset of #1772, which makes the same change to `translate` (any `\\?\` title path goes through `verbatim()`) and covers more: `\\?\` host roots, drive-root mounts and `GetDiskFreeSpaceW` volume roots. The two conflict in `files.rs`, and the only difference left here is a trailing backslash that names the same folder either way. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!421
No description provided.