Skip to content

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

Open
enzoduarte1 wants to merge 1 commit into
Marvisak:mainfrom
enzoduarte1:hle/verbatim-tail-normalization
Open

enzoduarte1 wants to merge 1 commit into
Marvisak:mainfrom
enzoduarte1:hle/verbatim-tail-normalization

Conversation

@enzoduarte1

Copy link
Copy Markdown
Contributor

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 Chore: clear two workspace Clippy errors #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.

@jeremygold02

Copy link
Copy Markdown
Contributor

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.

@mercuryVM mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested 1d0f48a on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed).

  • \?\ paths now go through verbatim, which also fixes a latent issue: if the mount root itself already starts with \?\ or is a UNC share, the old code put a second \?\ in front of it, and verbatim handles both cases.

  • The short path without the prefix produces the same output as before (root, a separator if needed, then the raw tail), so #182's area is not touched.

  • Two behaviour changes for \?\ paths that are worth knowing, not blocking:

    • A trailing separator is now dropped (\?\J:/a/ becomes …\a).
    • .. at the drive root is clamped to the root instead of being passed to the host.

    Both match what the long-path branch already did.

No issues found.

AI-assisted (Claude Code).

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
…ual-drive paths

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ghost ghost mentioned this pull request Nov 24, 2026

Copy link
Copy Markdown
Owner

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

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
nazmi pushed a commit to nazmi/VIctory that referenced this pull request Nov 25, 2026
Adapt upstream PR Marvisak#421 at 83b2037. Reuse verbatim cleanup for extended title paths while preserving the local non-extended parent-directory clamp.

Keep a separator for cleaned roots and trailing directory separators, including host drive roots. Add regressions for ordinary and verbatim drive/UNC roots.

(adapted from commit 83b2037)
nazmi added a commit to nazmi/VIctory that referenced this pull request Nov 25, 2026
…drive roots

Adapt source 83b2037 through candidate ed600eb and follow-up 20782e9. Preserve local parent clamping, root/trailing separators and test isolation. Source/candidate tests, negative controls, twenty parallel file-test runs and complete combined integration gate passed. Non-fast-forward merge as requested.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants