From owner-freebsd-current@FreeBSD.ORG Tue Sep 4 03:41:24 2007 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E438D16A417 for ; Tue, 4 Sep 2007 03:41:24 +0000 (UTC) (envelope-from ntarmos@ceid.upatras.gr) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id 62DB113C4B6 for ; Tue, 4 Sep 2007 03:41:24 +0000 (UTC) (envelope-from ntarmos@ceid.upatras.gr) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id BB98EEB48C1 for ; Tue, 4 Sep 2007 06:16:26 +0300 (EEST) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 6512D157C3B for ; Tue, 4 Sep 2007 06:16:26 +0300 (EEST) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dpvFPQMdjmVb for ; Tue, 4 Sep 2007 06:16:26 +0300 (EEST) Received: from ace.b020.ceid.upatras.gr (ppp235-080.dsl.hol.gr [89.210.235.80]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 0F739157BE1 for ; Tue, 4 Sep 2007 06:16:26 +0300 (EEST) Received: by ace.b020.ceid.upatras.gr (Postfix, from userid 1001) id 0220E3F40B; Tue, 4 Sep 2007 06:16:31 +0300 (EEST) Date: Tue, 4 Sep 2007 06:16:31 +0300 From: Nikos Ntarmos To: FreeBSD Current Message-ID: <20070904031631.GA24637@ace.b020.ceid.upatras.gr> Mail-Followup-To: FreeBSD Current References: <20070904030616.GA76410@ace.b020.ceid.upatras.gr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070904030616.GA76410@ace.b020.ceid.upatras.gr> Organization: NetCInS Lab., C.E.I.D., U. of Patras, Greece WWW-Homepage: http://ntarmos.dyndns.org/ X-PGP-Fingerprint: 9680 60A7 DE60 0298 B1F0 9B22 9BA2 7569 CF95 160A Office-Phone: +30-2610-996919 Office-Fax: +30-2610-969011 GPS-Info: 38.31N, 21.82E User-Agent: mutt-ng/devel-r804 (FreeBSD) Subject: find(1)'s -L and -delete not working well together (bin/90687) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2007 03:41:25 -0000 Hi there. I just submitted the following as a followup to bin/90687. I'm also posting it here should someone think it is important enough to go into the upcoming 7.0 release, since bin/90687 has been buried for nearly two years. I just stumbled upon this issue while reading the manpage for find(1). IMHO the fact that -delete turns -follow off is a good thing, so I consider this more of a bug in the manpage. The included patch removes the erroneous example and adds a word or two about -delete not honoring -L. There is a mention of -delete not interacting well with options that alter the traversal algorithm, but that is somewhat vague in this case. --- find.1.diff begins here --- Index: find.1 =================================================================== RCS file: /opt/freebsd/cvs/src/usr.bin/find/find.1,v retrieving revision 1.82 diff -u -r1.82 find.1 --- find.1 28 Feb 2007 10:19:25 -0000 1.82 +++ find.1 4 Sep 2007 02:56:40 -0000 @@ -306,6 +306,24 @@ .Dq Pa \&. for security reasons. Depth-first traversal processing is implied by this option. +Moreover, beware that +.Ic -delete +does +.Ar not +honor the semantics of +.Ic -L +since it turns off following of symbolic links for security reasons. +Thus, +.Pp +.Dl "find -L /usr/ports/packages -type l -delete" +.Pp +would delete +.Ar all +symbolic links under +.Ar /usr/ports/packages +as if +.Ic -L +had not been defined in the command line at all. .It Ic -depth Always true; same as the @@ -843,9 +861,6 @@ Use the .Xr echo 1 command to print out a list of all the files. -.It Li "find -L /usr/ports/packages -type l -delete" -Delete all broken symbolic links in -.Pa /usr/ports/packages . .It Li "find /usr/src -name CVS -prune -o -depth +6 -print" Find files and directories that are at least seven levels deep in the working directory ---- find.1.diff ends here ---- Cheers \n\n