Date: Tue, 4 Sep 2007 06:16:31 +0300 From: Nikos Ntarmos <ntarmos@ceid.upatras.gr> To: FreeBSD Current <freebsd-current@freebsd.org> Subject: find(1)'s -L and -delete not working well together (bin/90687) Message-ID: <20070904031631.GA24637@ace.b020.ceid.upatras.gr> In-Reply-To: <20070904030616.GA76410@ace.b020.ceid.upatras.gr> References: <20070904030616.GA76410@ace.b020.ceid.upatras.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070904031631.GA24637>