Policy: a path with .. below a directory not yet created resolves #252
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/252"
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?
Imported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T01:50:46Z.
ensure_outside_reporesolves a destination that does not exist yet by walking up to its longest existing prefix, canonicalizing that, and re-appending the rest. The walk takes each component withPath::file_name, which isNonefor a path ending in... So a destination with..below a directory that is not created yet, such as<tmp>/missing/../cache, fails withinstead of being checked. A cache or data directory configured that way is refused even though it is outside the repository (
Cache::open, the config'ssubdir, andvictory configreport it as an error).The fix takes the last component with
components().next_back()and accepts both normal names and..; the tail is already normalized lexically afterwards, somissing/../cachebecomescacheunder the canonical prefix. Root and prefix components still end the walk with the same error as before.The new test
resolves_dotdot_after_a_missing_directorychecks that<tmp>/missing/../cacheis accepted and that<repo>/not-yet-created/../outis reported asInsideRepo(it was anIoerror before). It fails onmainand passes with the fix.cargo test -p victory-coreandcargo clippy -p victory-core --all-targetspass (on Linux).config.rsis not touched.Imported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T02:28:11Z.
Superseded by #246, which now includes this change (rebased onto main, with its test).
Pull request closed