[Toybox] test.c patches on GitHub
Kevin Spiteri
kspiteri at ieee.org
Wed Sep 5 21:43:23 PDT 2018
>
> POSIX specifies that it *should* be inconsistent, i.e. the cases with 0,
> 1, 2, 3, and 4 args are different than the cases with 5 or more args. As
> always, this appears to be a historical compromise to reconcile the
> behavior of different shells in common cases.
>
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
> (scroll down)
>
Thanks, that explains it!
I edited a version I was using to address some issues mentioned in this
thread.
https://github.com/spiterikevin/toybox/blob/compoundtest/toys/pending/test.c
There are still some differences from coreutils. E.g., in coreutils,
[ \( \( \) \) \) ] is true because the inner \) is treated as a plain
string.
[ \( \( \( \) \) ] is a syntax error.
Removing one set of outer parentheses gets into the explicit 3-argument
special cases and both become true.
How important is it to match these details to coreutils? In my
implementation the 3-argument cases match, but both 5-argument cases are
syntax errors.
Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20180905/7ac5cfd3/attachment.htm>
More information about the Toybox
mailing list