Policy: resolve a .. in the not-yet-existing part of a path (port of VIctory#937) #53
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/uiliannn--VItoriaBr!53
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-53"
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?
@lcg007xd-c on GitHub · 2026-11-25 20:53 UTC · original
lcg007xd-c:port/policy-dotdot→main· +13 −0 · 1 files · 2 commits · openWhat
policy::resolvecanonicalizes the longest existing prefix of a path and re-appends the rest, so not-yet-created directories can be checked. It walks up withPath::file_name(), which isNonefor a trailing...So a
cache_dirordata_dirsuch as<somewhere>/new/../cache(nothing created yet) hit the_arm and failed withPolicyError::Ioinstead of being resolved. A trailing..is now kept in the re-appended tail, andnormalizeresolves it lexically, as its doc comment already says.This also matters for the new
is_withincheck from #42, which comparesresolved paths that may not exist yet. Without this change, adata_dirwith a..in its missing part makes that check fail with an I/O error.Port
Cherry-pick (
-x) ofgithub.com/Marvisak/VIctory@52f0a09from upstream https://github.com/Marvisak/VIctory/pull/937. nino-exe is still the commit author. It applied cleanly.Test
resolves_dot_dot_in_a_path_that_does_not_exist_yetfails onmain(theexpectonresolve) and passes with this change.How this was checked (Linux, no Windows PC or game files)
cargo clippy -p victory-core -p victory-pe -p victory-pipeline -p victory-shader -p victory-formats -p victory-game -p xtask --all-targets --locked -- -D warnings, thencargo teston the same crates (rebased on currentmain).cargo clippywith the same crates and--target x86_64-pc-windows-msvc(check only, no link) is clean.rustfmt --checkis clean on the changed file.Not tested: Windows runtime, GPU (D3D12/DXIL validation) and the game itself.
🤖 Generated with Claude Code
..in the not-yet-existing part of a path 60646cb4c9View 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.