Subject: Re: CVS commit: src/usr.bin/find
To: None <,>
From: ITOH Yasufumi <>
List: tech-userlevel
Date: 02/09/2007 13:03:51
In article <> writes:

> >>>>> On Thu, 08 Feb 2007 11:37:48 -0500,
>       "Perry E. Metzger" <> said:
> >> So, we now reached the conclusion that current implementation
> >> shouldn't have the name "-rm". Right?
> > Only if it should not have the name "-delete" either. :)
> Why?

find(1) is a command for listing files, not for removing files.
Adding a function to removing files in this way is dangerous in itself
and against "The Rule of Least Surprise".

If we really needs a function (or two?) to remove files in find,
I'd propose to implement it as a built-in command for -exec.

Here's the reason.

We could safely use "find *" to list files recursively excluding
dot-files in the current directory.
(This may not always work correctly, but it is safe, anyway.)
However, now we have -delete operator and, say, if you have

	% ls -l
	drwxr-xr-x  2 itohy  users  512 Feb  9 12:28 #precious#
	-rw-r--r--  1 itohy  users    0 Feb  9 12:28 -delete

in current directory, "find *" is expanded to

	find '#precious#' -delete

and the user will have undesirable result.

If the function is implemented as, "-exec find-builtin-rm '{}' ';'",
it should be much safer.

	% touch ./-exec find-builtin-rm '{}' \;
	% echo *
	-exec ; find-builtin-rm {}

ITOH Yasufumi