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--gone-20261201!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 60646cb4c9@lmouz823-lang on GitHub · 2026-11-28 04:10 UTC · original
I can take native Windows path-resolution validation at exact head
3d6f1247cd82e7cba869c166b0d42aa7f946ec51. I will run the missing-tail dot-dot regression, temporarily remove only the new tail-handling branch to check the expected failure, then restore and recompile. I will also check the core library tests and isolate the regression with a private temporary directory if needed to guarantee that its path suffix is missing. Exact results and any small test-only diff will follow here. AI-assisted with Codex.@lmouz823-lang on GitHub · 2026-11-28 04:17 UTC · original
Native Windows/MSVC validation completed on exact head
3d6f1247cd82e7cba869c166b0d42aa7f946ec51using Rust 1.98.1, the default test profile and an isolated target directory.The original
policy::tests::resolves_dot_dot_in_a_path_that_does_not_exist_yetregression executed one test and passed. Temporarily removing only the added trailing-..match branch made it fail withPolicyError::Io/NotFound(exit 101). Restoring the exact head triggered recompilation and the test passed again.I also strengthened that existing regression to use its own
tempfile::tempdir(), with an asserted-missingnot-createdbase anda/bchildren. Its expected path is built directly from the canonical existing temporary directory plusnot-created/b, making the missing-path precondition deterministic and checking the result against an independent expected value.The strengthened test passes on Windows. Removing the same branch makes it fail with
Io/NotFoundtoo, confirming that Windows path canonicalization does exercise the changed branch. After restoring and recompiling the final source, the exact regression passes, all 5 policy tests pass, and the complete 15-testvictory-core --libsuite passes with 0 failed, 0 ignored and 0 filtered out.The final proposed diff changes only the existing test, +10/-2 lines.
rustfmt --checkon the changed file,cargo clippy --locked -p victory-core --all-targets -- -D warnings, andgit diff --checkpass.Reproduction commands follow.
These checks cover native Windows path resolution with synthetic temporary directories. AI assistance from Codex covered the test, execution and this report.
Test-only independent missing-tail regression
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.