You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
find panics (unwrap None) on -ls for a file owned by an unmapped UID/GID #717
Running find <file> -ls on a file whose owning UID (or GID) has no entry in /etc/passwd (or /etc/group) panics and exits 101. -ls resolves the owner name with User::from_uid(...), which returns Ok(None) for an unmapped UID; the inner .unwrap() on that Option then panics. GNU find falls back to printing the numeric id instead. This is a routine condition: files from extracted archives that preserve foreign UIDs, NFS mounts, deleted accounts, and container images all produce unmapped owners.
Steps to reproduce
$ ./target/release/find /usr/local/lib/yottadb/r202/COPYING -lsthread 'main' panicked at src/find/matchers/ls.rs:155:57:called `Option::unwrap()` on a `None` value
$ echo$?101
(The host file /usr/local/lib/yottadb/r202/COPYING is owned by UID 228, which has no /etc/passwd entry; any file with an unmapped owning UID reproduces it.)
Expected behavior
Match GNU: print the entry using the numeric uid/gid, no crash, exit 0.
uutils find panics (Option::unwrap() on None) and exits 101. This triggers for any file whose owning UID lacks a /etc/passwd entry (line 155), and the identical sibling at line 159 triggers for any file whose GID lacks an /etc/group entry. The specific host path above is just one instance; the general portable condition (any unmapped owner/group) is what matters.
Root cause
// src/find/matchers/ls.rs:153let user = {let uid = metadata.uid();User::from_uid(Uid::from_raw(uid)).unwrap().unwrap().name};let group = {let gid = metadata.gid();Group::from_gid(Gid::from_raw(gid)).unwrap().unwrap().name};
User::from_uid / Group::from_gid return Ok(None) when the UID/GID has no passwd/group entry. The outer .unwrap() handles the Result; the inner .unwrap() then panics on the NoneOption.
Activity
leeewee commentedon Jul 15, 2026
Duplicate of #692