mirror of
https://github.com/uutils/findutils.git
synced 2026-06-10 15:48:30 -07:00
a70f5ccd7c071aaeb114774936e79e543dd5c361
`find <file> -ls` panicked (exit 101) when the file's owning uid (or gid) had no `/etc/passwd` (`/etc/group`) entry: it resolved the name with `User::from_uid(...).unwrap().unwrap()`, and the inner unwrap aborts on the `Ok(None)` that an unmapped id returns. Unmapped owners are routine (extracted archives, NFS, deleted accounts, container images). Resolve the uid/gid via `uucore::entries::uid2usr`/`gid2grp`, falling back to the numeric id when there is no entry, matching GNU find (which prints the number). These helpers already serialize the non-thread-safe getpwuid/getgrgid behind a mutex, so reuse them rather than reimplementing the lookup. Add a -ls integration test that chowns a file to an unmapped id and checks the numeric fallback; it skips when the process lacks the privilege to do so.
findutils
Rust implementation of GNU findutils: xargs, find, locate and updatedb.
The goal is to be a full drop-in replacement of the original commands.
Run the GNU testsuite on rust/findutils:
bash util/build-gnu.sh
# To run a specific test:
bash util/build-gnu.sh tests/misc/help-version.sh
Comparing with GNU
Build/run with BFS
bfs is a variant of the UNIX find command that operates breadth-first rather than depth-first.
bash util/build-bfs.sh
# To run a specific test:
bash util/build-bfs.sh posix/basic
For more details, see https://github.com/uutils/findutils-tracking/
Description
Languages
Rust
98.7%
Shell
1%
Python
0.3%