Subject: Re: CVS commit: src/usr.bin/find
To: SODA Noriyuki <soda@sra.co.jp>
From: Perry E. Metzger <perry@piermont.com>
List: tech-userlevel
Date: 02/07/2007 07:10:51
SODA Noriyuki <soda@sra.co.jp> writes:
>> "make -rm an alias for -delete"
>
> I think adding this "-rm" alias is a bad idea.
> (On the other hand, I'm one who asked Elad to add the -delete option.)

It is convenient.

> The "-delete" option is a very specific feature to deal with symbolic
> link race, and its usage is very limited.

It does not fix a symbolic link race. It is perfectly straightforward
to still cause the race if you want to. I don't understand why you
think you can fix this sort of race in userland -- without any sort of
kernel based locking it is impossible to fix all races.

> For examle, "find dir -delete" does work, but "find dir1/dir2 -delete"
> doesn't (this is intended feature to prevent the race).
> Adding short alias like "-rm" isn't suitable for this limited feature,
> IMHO.

This is a convenience for the users. A very common operation of "find"
is to remove files -- for example, I frequently do
 find /usr/src -name obj -type l -print | xargs rm
This set of flags conveniently allow people to do the same thing.

Not all features in an operating system are there because they are
"absolutely necessary". Some get put in place because they are
convenient, and making the lives of users easier is a nice
thing. FreeBSD has this flag and there is no particular reason not to
have the same convenient feature. I added "-rm" because that is the
name that the flag had under a certain fairly common Unix variant of
the mid 1980s and I've missed the feature ever since.

Perry