[Toybox] xargs with blank input

Rob Landley rob at landley.net
Thu Oct 31 06:31:27 PDT 2013


On 10/16/2013 02:16:47 PM, William Haddon wrote:
> How exactly should this behave? I haven't been able to decipher what  
> POSIX
> has to say about the subject. The GNU version executes the command  
> with no
> arguments, so that "xargs" with blank input is equivalent to "echo"  
> and
> "xargs ls" with blank input is equivalent to "ls".

In cases like this I test existing implementations (usually busybox,  
what's installed in ubuntu, and my old Red Hat 9 qemu image from 2003)  
to see what "expected Linux behavior" is.

For xargs, I also have a pending todo item: Rich Felker pointed out  
that our whitespace and quote handling behavior doesn't match the  
horrible posix corner cases that predate the -0 option. (Something  
about backslash escapes and multiline processing, I forget.) There's  
also a requirement ot leave 2048 bytes of environment variable space,  
which I don't think it's currently doing...

I need to reread the spec for fiddlybits and do another pass...

> Toybox currently appears to do nothing, but actually forks a child  
> process
> which silently seg-faults as a result of calling xexec() with argv[0]  
> == NULL.

Ok, that's wrong. :)

> Patching toybox to implement the GNU behavior fixes a lot of scripts  
> on my
> test system that broke when I switched the xargs implementation from  
> busybox
> to toybox, including the Linux build scripts.

Sounds good. I'll take a look, but have to catch a bus in something  
like 3 minutes...

Thanks,

Rob
 1383226287.0


More information about the Toybox mailing list