rewriting config_*, xmalloc_fget*

Rich Felker dalias at aerifal.cx
Thu Jun 16 18:27:02 UTC 2011


On Thu, Jun 16, 2011 at 11:07:55AM -0700, Cathey, Jim wrote:
> >Actually, xargs (the standard one, without -0) accepts a shell-quoted
> >list of filenames, so rather than -print0, find could have just been
> 
> Maybe now they do, but when they were first written
> they did not.  (Or so I understand.)  The -print0 solution
> was the easy/obvious choice, especially given that the NUL
> character couldn't be found in a filename.  It required near
> zero change to the existing code, and handled all weirdo
> filenames with ease.

Are you sure? As far as I know xargs has always behaved this way. It
would have been completely incompatible to make this change
retroactively if xargs had not originally behaved that way. In
particular, non-quoted whitespace (including spaces) is treated by
xargs as a delimiter - adding that behavior would have broken
everything using xargs if it weren't already behaving that way.

Sure -print0 required almost no change in the code for find, but it
requires significant change in any program using the output of find. I
maintain that shell quoting would have been a much better choice.

Rich


More information about the busybox mailing list