<div dir="ltr"><div><div></div><div>The issue is that chown/chgrp would error exit if it was passed an unknown numeric uid/gid.<br><a href="https://github.com/landley/toybox/issues/45">https://github.com/landley/toybox/issues/45</a><br><br></div><div>This all happens in the `xgetpwnamid` function (also applies to `<span class="">xgetgrnamid`)</span><br><a href="https://github.com/landley/toybox/blob/5b360d8da327b38daf0c5b8874fbe55406b70ced/lib/xwrap.c#L593">https://github.com/landley/toybox/blob/5b360d8da327b38daf0c5b8874fbe55406b70ced/lib/xwrap.c#L593</a></div><div><br></div><div>The function tries to resolve the text input to a uid, if it fails it takes the input and turns it into a uid, if that works it returns the `struct passwd`, otherwise it errors out.<br></div><div>Because it wants to return the looked up struct it fails if the uid/gid is unknown.<br></div><div><br></div><div>When looking at the uses of `xgetpwnamid`:<br><a href="https://github.com/landley/toybox/search?utf8=%E2%9C%93&q=xgetgrnamid">https://github.com/landley/toybox/search?utf8=%E2%9C%93&q=xgetgrnamid</a><br></div><div>It's used in:<br></div><div>- chgrp<br></div><div>- makedevs<br></div><div>- cp<br></div><div>- find<br></div><div>In each case the code wants to turn user-input into a uid/gid to further work with it.<br></div><div>In each case only the uid/gid wanted, not the whole passwd or group struct!<br></div><div>So `<span class="">xgetgrnamid` could actually return just `uid_t`</span><span class=""></span> and as far as I looked it up, for the 4 cases where it's used, an unknown uid/gid is fine.<br></div><div>(I think the function name also makes more sense if it returns an id).<br><br></div><div>So now we only error out if we have input that is neither a resolvable user/group and the input can't be turned into a number via `estrtol` either.<br><br></div>Find can  now search for unknown uid/gid too :)!<br></div><div><div><br></div></div></div>