From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 3 16:45:59 2008 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 4EA1C106567A for ; Thu, 3 Apr 2008 16:45:59 +0000 (UTC) (envelope-from mwm@mired.org) Received: from mired.org (student.mired.org [66.92.153.77]) by mx1.freebsd.org (Postfix) with ESMTP id E68428FC1F for ; Thu, 3 Apr 2008 16:45:58 +0000 (UTC) (envelope-from mwm@mired.org) Received: (qmail 47596 invoked from network); 3 Apr 2008 12:45:17 -0400 Received: from unknown (HELO mbook-fbsd) (192.168.195.251) by 0 with SMTP; 3 Apr 2008 12:45:17 -0400 Date: Thu, 3 Apr 2008 12:45:56 -0400 From: Mike Meyer To: Oliver Fromme Message-ID: <20080403124556.7e44c970@mbook-fbsd> In-Reply-To: <200804031559.m33FxKDr019153@lurza.secnetix.de> References: <20080324011708.107ec3cb@bhuda.mired.org> <200804031559.m33FxKDr019153@lurza.secnetix.de> Organization: Meyer Consulting X-Mailer: Claws Mail 3.0.2 (GTK+ 2.12.5; amd64-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Thu, 03 Apr 2008 16:59:46 +0000 Cc: freebsd-hackers@FreeBSD.ORG, mwm-keyword-freebsdhackers2.e313df@mired.org Subject: Re: Problem with find -prune... 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: Thu, 03 Apr 2008 16:45:59 -0000 On Thu, 3 Apr 2008 17:59:20 +0200 (CEST) Oliver Fromme wrote: > Mike Meyer <> wrote: > > find -prune seems to not quite do what it says. At least, when delete > > is used. Here's an example tree (on 7.0-RELEASE, amd64 build): > It behaves exactly as documented. I'll try to explain. I think you did an excellent job. Thank you. > > > > bhuda% find /tmp/x -prune -o -delete > > find: /tmp/x/y: Permission denied > > > > Why on earth (or off it) is find trying to look at /tmp/x? Am I > > correct in assuming that this is a bug? > > The -delete primary implicitly assumes depth-first > traversal (i.e. the -d option), because that's the > only way you can delete a whole directory tree. > > However, when depth-first traversal is in effect, > the -prune primary doesn't have any effect (for > obvious reasons). It's documented in the manpage. > > In other words, the primaries -prune and -delete > are mutual exclusive. It could be argued whether > find(1) should print a warning in that case. It might be better documented, also. So the bug that I'm *really* trying to scratch is in /etc/periodic/daily/100.clean-disks: rc=$(find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \ \( $args \) -atime +$daily_clean_disks_days -delete $print | tee /dev/stderr | wc -l) where it's using -prune and -delete in the same call to find. So I'll see if I can patch this, and file *that* bug report. Thanks again, http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information.