Skip to content

Add vfs::FileSystem::IsCaseSensitive volume probe (#45) - #208

Merged
helly25 merged 1 commit into
mainfrom
feat/vfs-case-sensitive
Jul 2, 2026
Merged

Add vfs::FileSystem::IsCaseSensitive volume probe (#45)#208
helly25 merged 1 commit into
mainfrom
feat/vfs-case-sensitive

Conversation

@helly25

@helly25 helly25 commented Jul 2, 2026

Copy link
Copy Markdown
Owner

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>:

  • macOS / BSD: 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).
  • Linux / glibc: no _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.
  • Unprobeable -> case-sensitive (byte-exact), which is always find-faithful.

Wiring: LocalFs implements it; the engine's DryRunFileSystem forwards it; the two test fakes (FakeFs, NoBtimeFs) return case-sensitive.

Test: local_fs_test cross-checks the probe against the volume's actual behaviour (does FILE.TXT resolve to a lower-case file.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 bare IsOk().

Next PR consumes this: --exact + the xff-style FS-native -name/-path default.

bazel test //... green (36 tests).

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.
@helly25
helly25 enabled auto-merge (squash) July 2, 2026 20:54
@helly25
helly25 merged commit 3ffe2f9 into main Jul 2, 2026
13 of 16 checks passed
@helly25
helly25 deleted the feat/vfs-case-sensitive branch July 2, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant