On 10/16/2013 11:35:15 PM, Robert Thompson wrote:
Not that it's really relevant to most linux environments, but the OSX
version (with a BSD manpage) appears to not execute any commandline
that
would have no added arguments. A quick test suggests this is true for
both
normal and null-separated modes.
Specifically, echo "" | xargs echo foo; echo "returned $?" will output
exactly one line: "returned 0", instead of the two lines seen on my
debian
test box. On the other hand, echo "bar" | xargs echo foo; echo
"returned
$?" behaves identically on both machines.
William implied that there were package builds that failed with the
previous toybox behavior? (It would be nice to know what those were.)
I keep forgetting that the default of xargs is "echo" and thus piping
things into "xargs echo" myself when I want to collate lots of lines
onto a single line.
The manpage mentions that "The xargs utility is expected to be IEEE
Std
1003.2 (``POSIX.2'') compliant.", for what it's worth.
Posix has holes you could drive a truck through. Its failure mode is
failing to specify stuff. (As failure modes go, that's a good one, but
the way it pretends mount and init don't exist is kinda annoying.)
It appears that they are reading the "shall construct ..." to
instruct that
if no arguments are read, there is no complete commandline, thus the
xargs
terminates without ever trying to launch a process, but without any
error.
Would a good rule be "if the input had a newline, we got a command
line. If the input was literally no data, we didn't"?
My tests on current osx 10.8 indicate that xargs never execs the
utility
and returns 0 for success.
The segfault was wrong, anyway. I applied the patch. This should give
you some idea how far behind I am on my email, but I just finished my
second week at the new job and may be reclaiming some sort of semblance
of normality, so... trying to catch up.
(If wasn't linux-kernel Documentation maintainer and could afford to
skip that list, this would be easier...)
Rob
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net