From owner-freebsd-hackers Tue Apr 1 21:57:47 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id VAA08287 for hackers-outgoing; Tue, 1 Apr 1997 21:57:47 -0800 (PST) Received: from scanner.worldgate.com (scanner.worldgate.com [198.161.84.3]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id VAA08282 for ; Tue, 1 Apr 1997 21:57:44 -0800 (PST) Received: from znep.com (uucp@localhost) by scanner.worldgate.com (8.8.5/8.7.3) with UUCP id WAA04005; Tue, 1 Apr 1997 22:57:40 -0700 (MST) Received: from localhost (marcs@localhost) by alive.znep.com (8.7.5/8.7.3) with SMTP id WAA10946; Tue, 1 Apr 1997 22:57:29 -0700 (MST) Date: Tue, 1 Apr 1997 22:57:28 -0700 (MST) From: Marc Slemko To: dmaddox@scsn.net cc: hackers@FreeBSD.org Subject: Re: `find . -nogroup` doesn't work? In-Reply-To: <199704020459.XAA00487@cola134.scsn.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk On Tue, 1 Apr 1997, Donald J. Maddox wrote: > > I was attempting to use find(1) to locate files/dirs on > my system that have bogus owners/groups, but it appears > that the '-nogroup' and '-noowner' options don't work.. > > Below is a partial listing of the files in my ghostscript > fonts dir. You will notice that there are a number of entries > with unknown owners/groups: Looks to me like a bug in the group_from_gid and user_from_uid functions in pwcache.c. They set the user name to be equal to the uid if it can't be found, but when using a cached name they completely disregard the second (nouser) parameter and return it anyway. This breaks find and looks like a bug in the library functions. To fix this, I think it would either need a flag that is set when the cp->name is generated from cp->uid (can't do a comparison later, since nothing says "111" can't be a valid user name for user 111, right?) or not put it the uid into cp->name if it isn't found and do the snprintf each time it is needed if called with nouser == 0. This problem annoyed me too, but haven't had time to do anything about it.