Skip to content

Extend -size units to E + reject over-64-bit / unknown units - #169

Merged
helly25 merged 1 commit into
mainfrom
feat/size-units-tpe
Jun 27, 2026
Merged

Extend -size units to E + reject over-64-bit / unknown units#169
helly25 merged 1 commit into
mainfrom
feat/size-units-tpe

Conversation

@helly25

@helly25 helly25 commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Summary

Review feedback on the freshly-added kSizeUnits map: complete the -size unit scale, and stop silently no-matching invalid units.

  • kSizeUnits gains T (2^40), P (2^50), E (2^60). T/P are find-native (BSD find accepts up to P; verified). E is an xff continuation of the same binary scale -- a strict superset that changes the meaning of no find-valid input -- so all three are valid in every flavor, including --config=find (ungated; they're continuations, not conflicts). Z/Y/R/Q (2^70+) can't be added: they overflow the 64-bit byte count.
  • -size arguments are now validated. MatchesSize is refactored onto ParseSizeSpec, and a new ValidateSizeArgs walks the expression; the driver runs it before traversal. An over-64-bit unit (Z/Y/R/Q) is rejected naming the limit -- "the largest size unit is E (exabyte)" -- and an unknown unit is rejected too, both exit 2. Previously a bad -size silently matched nothing; real find errors at parse time, so this is also more find-faithful.
$ xff . -size +1Z
xff: -size: '+1Z': size unit 'Z' exceeds xff's 64-bit byte range; the largest size unit is E (exabyte)
$ echo $?
2

Tests

  • evaluate_test: SizeMatchesLargeUnits (T/P/E with exact multiples), ValidateSizeArgsRejectsBadUnits (valid units pass; Z and unknown rejected with messages).
  • run_test: OversizedSizeUnitIsRefusedBeforeTraversal (exit 2, names the limit, no traversal).
  • Verified on the binary: T/P/E accepted incl. under --config=find; +1Z and 1q error with exit 2.

Green on default and --config=asan; clang-format + pre-commit clean.

Per review feedback: complete the -size unit scale and stop silently
no-matching bad units.

- kSizeUnits gains T (2^40), P (2^50), E (2^60). T/P are find-native (BSD
  accepts up to P); E is an xff continuation of the same binary scale -- a strict
  superset that changes no find-valid input -- so all three are valid in every
  flavor (including --config=find), ungated. Z/Y/... (2^70+) cannot be added:
  they overflow the 64-bit byte count.
- MatchesSize is refactored onto ParseSizeSpec, which validates the argument.
  ValidateSizeArgs (new, evaluate.h) walks the expression and the driver runs it
  before traversal: an over-64-bit unit (Z/Y/R/Q) is rejected naming the limit
  ("the largest size unit is E (exabyte)"), an unknown unit is rejected too, both
  exit 2. Previously a bad -size silently matched nothing; find errors at parse
  time, so this is also more find-faithful.

Tests: evaluate_test SizeMatchesLargeUnits (T/P/E) and ValidateSizeArgsRejectsBadUnits;
run_test OversizedSizeUnitIsRefusedBeforeTraversal (exit 2, names the limit, no
traversal). Verified on the binary (T/P/E accepted incl. --config=find; +1Z and 1q
error with exit 2). Green on default and asan.
@helly25
helly25 enabled auto-merge (squash) June 27, 2026 22:35
@helly25
helly25 merged commit 5a17492 into main Jun 27, 2026
8 checks passed
@helly25
helly25 deleted the feat/size-units-tpe branch June 27, 2026 22:40
helly25 added a commit that referenced this pull request Aug 8, 2026
…2 unblock (#403)

* docs(TODO): add fuzzy finding + w-shingling near-duplicate detection idea

Records two distinct 'approximate match' capabilities under deferred ideas:
(1) fzf/fd-style fuzzy name/path matching as its own -fuzzy primary (subsequence
vs bounded edit distance; ties into --sort=score/--top); (2) content
near-duplicate/similarity via w-shingling (Jaccard over shingle sets, MinHash
to scale) as a per-entry matcher against a reference file plus an optional
cross-tree clustering reduction. Notes the design-open points (shingle width,
threshold, v1 scope, likely a build extra). TaskList #168.

* docs(TODO): add MemorySanitizer (MSan) feasibility check

Records the question of enabling MSan (uninitialized-read detection) as a
fourth sanitizer: macOS is out (Clang/Linux-only), the blocker is needing an
MSan-instrumented libc++ (everything else builds from source and gets the
flag for free), so the task is to check whether the hermetic LLVM toolchain
can supply one and, if so, add a --config=msan + Linux CI cell - else record
why not so it isn't re-litigated. TaskList #169.

* docs(TODO): record clang-tidy-22 unblock (mbo #270 compile-DB fix)

Corrects the clang-tidy follow-up: the parse abort was the compile DB
recording Apple clang (not the <version>-shadowing theory), fixed by mbo
#270. Records the port checklist (extractor pin bump, hermetic --bcce-compiler
+ prefer-target-config + Darwin isysroot, the CharTypedefsToIgnore fix, a
report-only CI job) and defers the finding sweep + gating.
helly25 added a commit that referenced this pull request Aug 9, 2026
The first msan CI run failed at cmake configure: the runtimes CMakeLists
add_subdirectory()s llvm/utils/llvm-lit for its check targets, which the
partial source extraction did not include. Turn the test machinery off
(-DLLVM_INCLUDE_TESTS=OFF; we only want the libraries) and extract llvm/utils
as well so the path exists either way.
helly25 added a commit that referenced this pull request Aug 9, 2026
Second configure/compile failure from the hand-picked extraction: libcxx's
from_chars_floating_point.h includes shared/fp_bits.h, which lives under libc/,
just as the earlier failure needed llvm/utils/llvm-lit. Picking directories is a
losing game - each attempt only surfaces the next missing one - so extract the
whole source release. It costs seconds, the tree is discarded afterwards, and
what CI caches is the INSTALLED runtimes, not the sources.
helly25 added a commit that referenced this pull request Aug 9, 2026
The done job asserts that EVERY declared workflow job is listed in its needs -
a guard against adding a job that silently is not gated - and adding msan
without wiring it tripped exactly that check.

msan belongs in needs like the rest: the gate step only inspects the needs KEY
SET, never the results, and a continue-on-error job cannot fail the run. So
listing it restores the completeness invariant while a red msan still cannot
block a merge, which is the whole point of introducing it report-only.
helly25 added a commit that referenced this pull request Aug 9, 2026
* docs(#109): park the single-pass verify tally as a deferred refinement

The -hasheq matcher and --summary=hash dedup grouping cover the practical
hash-verification workflow. A one-pass verified/failed tally needs the per-entry
verdict threaded thread-safely through the reduction feed (parallel walk / tsan);
parked with that note until a concrete need appears.

* docs(#109): mark hash-verification workflow done

* feat(#169): MemorySanitizer via an instrumented libc++, Linux CI cell

MSan catches reads of uninitialized memory that asan does not. The one real
prerequisite is an instrumented C++ standard library: MSan false-positives on
anything it did not instrument, and while every other dep builds from source
under bazel (so -fsanitize=memory reaches it), libc++ ships prebuilt inside the
hermetic LLVM.

- tools/build_msan_libcxx.sh builds libc++/libc++abi/libunwind from the LLVM
  source release matching bazelmod/llvm.MODULE.bazel's llvm_version, with
  -DLLVM_USE_SANITIZER=MemoryWithOrigins and the hermetic clang as compiler,
  into .msan-libcxx/ (gitignored). It stamps the prefix with version+script hash
  so a cached tree is reused, and skips cleanly on non-Linux.
- .bazelrc --config=msan mirrors asan/tsan and swaps the runtime in via
  -nostdinc++ -isystem .../include/c++/v1 and -nostdlib++ -L... -Wl,-rpath,...
- CI gains one ubuntu `msan` cell (never macOS: MSan has no macOS support) with
  the instrumented libc++ cached on the LLVM version + script hash. It starts
  continue-on-error while first findings are triaged - the same introduction
  path the clang-tidy cell took - then becomes a hard gate.

Also folds the ratified archive control surface into the docs so nothing is left
open before that work starts: --archive[=none|roots|all] + -z/-z+/-z- with find
-> none and the xff family -> roots, dual container identity, --archive-depth=1,
sniff-gating, and the pre-implementation "not yet implemented" guard. Rewrites
the stale smart-case entry (it shipped as --case=smart/-s, not a boolean), and
resolves the remaining design.md TBDs (PCRE2 spelling is --regextype=PCRE2; the
VFS seam is built, remote backends stay post-v1).

* fix(#169): runtimes build needs llvm-lit off / present

The first msan CI run failed at cmake configure: the runtimes CMakeLists
add_subdirectory()s llvm/utils/llvm-lit for its check targets, which the
partial source extraction did not include. Turn the test machinery off
(-DLLVM_INCLUDE_TESTS=OFF; we only want the libraries) and extract llvm/utils
as well so the path exists either way.

* fix(#169): extract the whole LLVM source release for the runtimes build

Second configure/compile failure from the hand-picked extraction: libcxx's
from_chars_floating_point.h includes shared/fp_bits.h, which lives under libc/,
just as the earlier failure needed llvm/utils/llvm-lit. Picking directories is a
losing game - each attempt only surfaces the next missing one - so extract the
whole source release. It costs seconds, the tree is discarded afterwards, and
what CI caches is the INSTALLED runtimes, not the sources.

* fix(#169): wire msan into the done gate

The done job asserts that EVERY declared workflow job is listed in its needs -
a guard against adding a job that silently is not gated - and adding msan
without wiring it tripped exactly that check.

msan belongs in needs like the rest: the gate step only inspects the needs KEY
SET, never the results, and a continue-on-error job cannot fail the run. So
listing it restores the completeness invariant while a red msan still cannot
block a merge, which is the whole point of introducing it report-only.
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