Some improvements to rm(1)
Jilles Tjoelker
jilles at stack.nl
Fri Apr 26 14:17:29 UTC 2013
On Fri, Apr 26, 2013 at 08:33:54AM -0500, Joshua Isom wrote:
> On 4/26/2013 7:23 AM, Eitan Adler wrote:
> > Yes, rm's functionality can be fully replicated by find.
> As well as anything using -R.
Emulating other -R things using find becomes quite slow when you don't
want to impose {PATH_MAX} limits or open up symlink-based race windows
because the only safe option is -execdir UTILITY {} \;. Any find command
based on -exec, -print or -print0 passes pathnames which are subject to
{PATH_MAX} limits and directories concurrently replaced with symlinks.
The construct -execdir ... {} + is unusably broken in older FreeBSD
versions and gives no advantage compared to -execdir ... {} \; in recent
-CURRENT.
With -L, this is not a new problem because symlinks are followed anyway
and the underlying code (fts(3)) always imposes the {PATH_MAX} limit in
that case.
The -delete primary is safe like -execdir.
I'm not entirely sure about this because the rm(1) patch is simple and
the new syntax is fairly clear.
--
Jilles Tjoelker
More information about the freebsd-hackers
mailing list