On Thu, Mar 19, 2020 at 10:38:30PM +0100, Christian Weisgerber wrote:
> Make use of "find -exec {} +" (which is POSIX) and "find -delete"
> (which is not) throughout the ports Makefiles.
>
> Specifically:
>
> * Replace find|xargs with find -exec {} +
> find|xargs is an outdated construct. The -exec {} + invocation
> automatically avoids a number of corner cases (see xargs -0, -r).
> Also, since the exit status of the left-hand side of a pipe is
> ignored, find|xargs hides some problem.
>
> * Replace -exec {} \; with -exec {} + if applicable.
> Calling a command a few times with many arguments is simply more
> efficient than calling it many times with a single argument.
>
> * Use the -delete operator to remove files and empty directories.
> I'm ambivalent about this since it isn't POSIX, but people seem
> to like it.
>
> I also combined and tweaked some find(1) invocations while there.
>
> The patch touches 136 files, so it's possible a mistake has slipped
> in, but it successfully passed an amd64 bulk build.
>
> x11/qt5/Makefile.inc runs find(1) on directories that don't exist
> in all qt5/* ports. Previously the find|xargs construct accidentally
> hid the find errors. I went with -find here, i.e., use make's "-"
> to ignore any non-zero exit status.
>
> OK?
Yes.
I'm definitely responsible for some of the old cruft.
To my defense, it probably predates -exec {} + (2012) and -delete (2017) :)