From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 6 17:41:00 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CA8EA16A420 for ; Mon, 6 Mar 2006 17:41:00 +0000 (GMT) (envelope-from jilles@stack.nl) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 72C7F43D45 for ; Mon, 6 Mar 2006 17:40:59 +0000 (GMT) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mailhost.stack.nl (Postfix) with ESMTP id E555AA2FFB for ; Mon, 6 Mar 2006 18:40:58 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id CE2ED228B7; Mon, 6 Mar 2006 18:40:58 +0100 (CET) Date: Mon, 6 Mar 2006 18:40:58 +0100 From: Jilles Tjoelker To: freebsd-hackers@freebsd.org Message-ID: <20060306174058.GA32164@stack.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: FreeBSD 5.4-RELEASE i386 User-Agent: Mutt/1.5.11 Subject: find(1) -d vs -prune; /etc/periodic/daily/100.clean-disks 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, 06 Mar 2006 17:41:00 -0000 find(1)'s -prune primary does not work if depth-first traversal (-d, -depth, also implied by -delete) is in effect. The reason is that it is (obviously) not possible to prune a directory when visiting it after all entries in it. This causes /etc/periodic/daily/100.clean-disks (if enabled) to recurse through all read-only and NFS filesystems as well. More concrete examples: find -d / \( '!' -fstype local -o -fstype rdonly \) -a -prune -o \( -name '*.core' -o -name '.nfs[A-z][0-9a-f][0-9a-f][0-9a-f][0-9a-f]4.4' \) -atime +1 -print >/dev/null 2>&1 find /someserver.mnt \( '!' -fstype local -o -fstype rdonly \) -a -prune -print >/dev/null 2>&1 (/someserver.mnt assumed to be not a mount point here) Possible solutions/workarounds: 1. do still call -prune and some primaries without side effects in pre-order even if -d is in effect, even though this does not fit at all in find(1)'s design. 2. document the bug and run a find -x over all local r/w filesystems in 100.clean-disks (-x and -d work together properly). What would be the best way to go on? -- Jilles Tjoelker