[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Use find ... | xargs rm -f instead of find ... -delete
From: |
Matthias Kilian |
Subject: |
Re: [PATCH] Use find ... | xargs rm -f instead of find ... -delete |
Date: |
Tue, 29 Dec 2009 20:00:46 +0100 |
User-agent: |
Mutt/1.4.2.3i |
On Tue, Dec 29, 2009 at 08:16:37AM +0100, David Kastrup wrote:
> > - find $(outdir)/offline-root -type l -delete
> > + find $(outdir)/offline-root -type l | xargs rm -f
> > endif # ifeq ($(out),www)
>
> What's the rationale?
The `-delete' primary isn't very portable, it's a GNU extension.
> The latter form is less efficient
I doubt it's measurable. Using find ... -exec ... {} ... ; would
be inefficient, but using find and xargs should be fast.
> and less secure
> (if somebody places files with spaces or newlines into the latter
> directory, things may get ugly).
Then change it to something like this:
find $(outdir)/offline-root -type l -print0 | xargs -0 rm -f --
Or even this (completely POSIX compliant):
find $(outdir)/offline-root -type -l -exec rm -f -- '{}' +
(but then I've to patch it again, since find(1) on OpenBSD doesn't yet
support the `-exec command {} +' primary).
Ciao,
Kili