Opening the output file with `?` surfaced a bare "No such file or
directory" with no indication of which file failed (easy to hit because the
default output path /usr/local/var/locatedb often doesn't exist).
Report it like GNU does, naming the path and the reason, e.g.
`cannot create '/usr/local/var/locatedb': No such file or directory`.
strip_errno() drops the trailing "(os error N)" noise.
The -fstype matcher called path.symlink_metadata() (a statx/lstat syscall)
on every entry before consulting its cache, just to obtain the device id.
With several -fstype clauses on the same expression (as updatedb builds:
nfs/NFS/proc), every file was stat'd once per clause.
Derive the device id from WalkEntry::metadata() instead, which is cached on
the entry in a OnceCell and shared across all matchers, so each file is
stat'd at most once regardless of how many -fstype clauses run.
On 'updatedb --localpaths=/usr' (~506k files) this drops statx calls from
~1.52M to ~506k and wall-clock from ~1.82s to ~1.32s, with byte-identical
output.
Enable the broader clippy lint set used by uutils/coreutils (the all,
cargo and pedantic groups plus the use_self nursery lint), allowing the
noisy/low-value lints. The preceding commits fix the warnings these
groups surface so the tree stays warning-free.
locate and updatedb were Unix-only (gated behind cfg and stubbed out on
Windows). Make them cross-platform:
- locate: decode raw DB entries via a platform-specific bytes_to_path
(verbatim bytes on Unix, lossy UTF-8 elsewhere), use Metadata::len()
instead of the unix-only size(), and a cross-platform make_symlink in
tests that skips gracefully when symlink creation is unprivileged.
- drop the #[cfg(unix)] gate on the locate module and the
"unsupported on Windows" main stubs for locate/updatedb.
- db_tests: remove #[cfg(not(windows))] gates, write updatedb output to
a tempdir instead of /dev/null, and add a full updatedb->locate
roundtrip test that is platform-independent.
Replace the "early alpha implementation" placeholder help text with a
proper organized reference grouped by category (global options,
operators, positional options, tests, and actions), with brief
descriptions for each entry. The old text was a flat list that hadn't
kept up with the implementation and still carried the "early alpha"
disclaimer.
Also fix a typo in a comment: "- newercm" -> "-newercm".
Drive both utilities end-to-end through their real entry points.
- benches/updatedb_bench.rs: walks a generated tree (~8.5k paths) and
writes a LOCATE02 database, measuring the walk + front-coding + write
(full build and a -regex/-prune variant). Empty prune options keep the
run deterministic regardless of temp_dir location.
- benches/locate_bench.rs: builds the database once via updatedb, then
scans it in -c/count mode so database decoding and pattern matching
dominate (no-match, substring, -b basename, -i ignore-case, -r regex).
Unix-only, matching the locate module's cfg.
The existing CodSpeed workflow picks these up via cargo codspeed build/run.
Introduce criterion benchmarks (via codspeed-criterion-compat) that drive
find and xargs end-to-end through their real entry points, plus a CodSpeed
GitHub Actions workflow to track performance on pushes and PRs.
- benches/find_bench.rs: walks a generated directory tree exercising the
matcher tree (-name/-iname/-regex/-size/-type, grouping, -prune, -printf).
Output is sent to a sink so the directory walk and matching dominate.
- benches/xargs_bench.rs: feeds a corpus via -a and runs 'true' so xargs'
own argument reading/splitting/batching dominates (whitespace, NUL, -n, -s).
- .github/workflows/codspeed.yml: mirrors the uutils/grep setup.