Subject: Re: CVS commit: src/usr.bin/find
To: None <tech-userlevel@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-userlevel
Date: 02/08/2007 13:20:36
> I'd be happy enough with "-rm" should do what people expect and
> "-delete" can stay as it is, though I would prefer that both do what
> people expect.

In what material way do you believe people's expectation differs from
what -rm/-delete does?  I find the code somewhat obscure, but the only
difference I can see is that -delete may fail to delete something if
fts() doesn't happen to have chosen to chdir() into its parent
directory.

Since I note that fts says it may, but does not say it will, change
into the parent directory, I conclude that the code is somewhat buggy
for its apparently-intended purpose.  Furthermore, fts doesn't promise
it won't leave itself in a subdir while ascending into a higher dir
(this amounts to assuming fts_accpath never begins with "../"), which
breaks even the "find -depth -print0 | xargs -0 rm" method of removing
stuff, in the presence of directories big enough that the list of names
doesn't get wholly buffered by the pipe.

In short, fts needs to be improved, or find needs to stop using it.
(This conclusion is actually independent of -delete, so I suppose I
really ought to just submit a PR for it....)

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B