find(1)'s -L and -delete not working well together (bin/90687)

From: Nikos Ntarmos <ntarmos_at_ceid.upatras.gr>
Date: Tue, 4 Sep 2007 06:16:31 +0300
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
_at__at_ -306,6 +306,24 _at__at_
 .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
_at__at_ -843,9 +861,6 _at__at_
 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
Received on Tue Sep 04 2007 - 01:41:24 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:17 UTC