From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 29 22:22:04 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D036B1065675 for ; Mon, 29 Nov 2010 22:22:04 +0000 (UTC) (envelope-from bakul@bitblocks.com) Received: from mail.bitblocks.com (ns1.bitblocks.com [64.142.15.60]) by mx1.freebsd.org (Postfix) with ESMTP id B2A5F8FC0A for ; Mon, 29 Nov 2010 22:22:04 +0000 (UTC) Received: from bitblocks.com (localhost.bitblocks.com [127.0.0.1]) by mail.bitblocks.com (Postfix) with ESMTP id 159C45B18; Mon, 29 Nov 2010 14:16:47 -0800 (PST) To: Matthew Jacob In-reply-to: Your message of "Mon, 29 Nov 2010 12:39:43 PST." <4CF40F8F.30303@feral.com> References: <86r5e3zye4.fsf@pluton.xbsd.name> <4CF40F8F.30303@feral.com> Comments: In-reply-to Matthew Jacob message dated "Mon, 29 Nov 2010 12:39:43 -0800." Date: Mon, 29 Nov 2010 14:16:47 -0800 From: Bakul Shah Message-Id: <20101129221648.159C45B18@mail.bitblocks.com> Cc: freebsd-hackers@freebsd.org Subject: Re: find(1): Is this a bug or not? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2010 22:22:04 -0000 On Mon, 29 Nov 2010 12:39:43 PST Matthew Jacob wrote: > can you report out the actual command line you're using and what release > it's from? > > On 11/29/2010 12:08 PM, Denise H. G. wrote: > > Hi, > > > > I found that, while searching for empty directories, find(1) will not > > continue if it encounters a dir it can't enter (e.g. no privilege). I > > don't know if it's so designed... I've checked NetBSD and OpenBSD's > > implementations (almost identical to that of FreeBSD's). And they behave > > the same way as FreeBSD's find(1) does under the circumstance. > > > > I'm wondering if this is a bug or not. This looks like a long standing bug: % mkdir -p a/{b,c}/d/e/f % find a -empty % chmod 000 a/b/d/ef % find a -empty The fix: % cd /usr/src/usr.bin/find % svn diff Index: function.c =================================================================== --- function.c (revision 212707) +++ function.c (working copy) @@ -560,7 +560,7 @@ empty = 1; dir = opendir(entry->fts_accpath); if (dir == NULL) - err(1, "%s", entry->fts_accpath); + return 0; for (dp = readdir(dir); dp; dp = readdir(dir)) if (dp->d_name[0] != '.' || (dp->d_name[1] != '\0' &&