fix(core): detect case-insensitive overlap for nonexistent cache/data dirs on Windows #103

Open
github-bot wants to merge 1 commit from github-bot/gh-103 into main AGit
Owner

@⁠Djei365 on GitHub · 2026-11-25 22:59 UTC · original
Djei365:fix/windows-cache-data-case-overlap → main · +377 −1 · 2 files · 1 commits · open

Closes #55

Problem

The overlap protection introduced in #42 can miss equivalent Windows paths when directory components do not exist yet and differ only in letter case.

For example, on a case-insensitive NTFS directory:

  • cache_dir = cache
  • data_dir = CACHE/saves

These paths may overlap once created, potentially exposing persistent data to cache cleanup.

Solution

  • Detect case-insensitive overlap between nonexistent path components on Windows.
  • Query case sensitivity from the nearest existing ancestor.
  • Use Windows ordinal Unicode comparison.
  • Preserve case-sensitive directories, unrelated sibling paths, inverse nesting, and non-Windows behavior.
  • Reject indeterminate case-sensitivity queries rather than silently assuming case-insensitivity.
  • Avoid creating directories during configuration validation.
  • Introduce no new dependencies.

The existing ensure_outside_repo policy remains unchanged.

Validation

  • 21 unit tests passed.
  • Case-sensitive NTFS control test passed separately.
  • ASCII and Unicode regression tests passed.
  • Multiple nonexistent path components tested.
  • Interior NUL regression tested.
  • Rustfmt passed.
  • Clippy passed with -D warnings.
  • Git diff checks passed.

All local checks were repeated successfully after rebasing onto upstream main.

Limitations

Local validation was performed on Windows with NTFS. Non-Windows execution, alternative filesystems, and older Windows versions were not tested locally.

Case-sensitivity inference assumes normal directory inheritance and cannot anticipate future filesystem configuration changes.

Acknowledgment

This change builds upon the overlap protection introduced by @⁠LouisRiverstone in #42.

**@⁠Djei365** on GitHub · 2026-11-25 22:59 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/103) `Djei365:fix/windows-cache-data-case-overlap` → `main` · +377 −1 · 2 files · 1 commits · open Closes #55 ## Problem The overlap protection introduced in #42 can miss equivalent Windows paths when directory components do not exist yet and differ only in letter case. For example, on a case-insensitive NTFS directory: - `cache_dir = cache` - `data_dir = CACHE/saves` These paths may overlap once created, potentially exposing persistent data to cache cleanup. ## Solution - Detect case-insensitive overlap between nonexistent path components on Windows. - Query case sensitivity from the nearest existing ancestor. - Use Windows ordinal Unicode comparison. - Preserve case-sensitive directories, unrelated sibling paths, inverse nesting, and non-Windows behavior. - Reject indeterminate case-sensitivity queries rather than silently assuming case-insensitivity. - Avoid creating directories during configuration validation. - Introduce no new dependencies. The existing `ensure_outside_repo` policy remains unchanged. ## Validation - [x] 21 unit tests passed. - [x] Case-sensitive NTFS control test passed separately. - [x] ASCII and Unicode regression tests passed. - [x] Multiple nonexistent path components tested. - [x] Interior NUL regression tested. - [x] Rustfmt passed. - [x] Clippy passed with `-D warnings`. - [x] Git diff checks passed. All local checks were repeated successfully after rebasing onto upstream main. ## Limitations Local validation was performed on Windows with NTFS. Non-Windows execution, alternative filesystems, and older Windows versions were not tested locally. Case-sensitivity inference assumes normal directory inheritance and cannot anticipate future filesystem configuration changes. ## Acknowledgment This change builds upon the overlap protection introduced by @⁠LouisRiverstone in #42.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:44:02 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/103/head:github-bot/gh-103'
git switch 'github-bot/gh-103'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-103'
git switch 'github-bot/gh-103'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-103'
git switch 'github-bot/gh-103'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-103'
git switch 'main'
git merge --squash 'github-bot/gh-103'
git switch 'main'
git merge --ff-only 'github-bot/gh-103'
git switch 'main'
git merge 'github-bot/gh-103'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.