Add vfs::FileSystem::IsCaseSensitive volume probe (#45) - #208
Merged
Conversation
Foundation for xff's FS-native name matching: a per-volume case-sensitivity query on the FileSystem interface. LocalFs answers it via pathconf(_PC_CASE_SENSITIVE) on macOS/BSD (1 = case-sensitive, 0 = folding); on Linux, where glibc has no such name, it reports case-sensitive (ext4/xfs/btrfs default; per-directory casefold via statx STATX_ATTR_CASEFOLD is a later refinement). An unprobeable volume falls back to case-sensitive (byte-exact), which is always find-faithful. The engine's DryRunFileSystem forwards it; the walk/run test fakes return case-sensitive. local_fs_test cross-checks the probe against the volume's actual behaviour (whether FILE.TXT resolves to a lower-case file.txt), so it is correct on both case-sensitive and case-folding runners without hard-coding a platform. No behaviour change yet: --exact and the FS-native -name default consume this next.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First PR for #45 (
--exact/ FS-native name matching). Adds the per-volume case-sensitivity capability the feature is built on; no behaviour change yet.vfs::FileSystem::IsCaseSensitive(path)->absl::StatusOr<bool>:pathconf(path, _PC_CASE_SENSITIVE)- 1 = case-sensitive, 0 = case-folding (APFS/HFS+ default, NTFS, exFAT). A -1 return is an error (errno set, propagated) or indeterminate (errno 0 -> conservative case-sensitive)._PC_CASE_SENSITIVE; reports case-sensitive (ext4/xfs/btrfs default). Per-directory casefold (ext4+F/statx STATX_ATTR_CASEFOLD) is a later refinement noted inline.Wiring:
LocalFsimplements it; the engine'sDryRunFileSystemforwards it; the two test fakes (FakeFs,NoBtimeFs) return case-sensitive.Test:
local_fs_testcross-checks the probe against the volume's actual behaviour (doesFILE.TXTresolve to a lower-casefile.txt?), so it is correct on both case-sensitive (Linux CI) and case-folding (macOS) runners without hard-coding a platform - a stronger assertion than a bareIsOk().Next PR consumes this:
--exact+ the xff-style FS-native-name/-pathdefault.bazel test //...green (36 tests).