Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Apr 2008 12:45:56 -0400
From:      Mike Meyer <mwm@mired.org>
To:        Oliver Fromme <olli@lurza.secnetix.de>
Cc:        freebsd-hackers@FreeBSD.ORG, mwm-keyword-freebsdhackers2.e313df@mired.org
Subject:   Re: Problem with find -prune...
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>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 3 Apr 2008 17:59:20 +0200 (CEST) Oliver Fromme <olli@lurza.secnetix.de> 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,
   <mike
-- 
Mike Meyer <mwm@mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080403124556.7e44c970>