[Toybox] test.c hex/octal bug
Luke Frankart
frankart at google.com
Wed Nov 25 16:54:41 PST 2020
Thanks for the quick reply and updates. Works great now!
Luke
On Wed, Nov 25, 2020 at 3:53 PM Rob Landley <rob at landley.net> wrote:
> On 11/24/20 5:06 PM, Luke Frankart wrote:
> > I found that `toybox test -w` returned true for a file with 0440 mode
> bits, and
> > was able to find failures for other cases (below).
> >
> > I think the root cause and fix is to use octal 0111 instead of
> hexadecimal 0x111
> > on this line:
> > https://github.com/landley/toybox/blob/master/toys/posix/test.c#L74
>
> Oops. Reflex. I should add a test for this...
>
> And "make test_test" fails because it complains there's no trailing ']'
> which it
> should only do when called as '[', and that's because a standalone build
> of test
> doesn't include the command multiplexer so it doesn't dispatch on the
> filename,
> instead it hardwired calls the first entry in toy_list which is sorted and
> '['
> comes before 't'. The fix is to USE_SH() instead of USE_TEST() around the
> OLDTOY() since it's a nofork so the [ version can _only_ be called from the
> shell (unlike busybox which installs it in the filesystem for some reason).
>
> Ah, and the _other_ reason tests/test.test hasn't got chmod +x on it (so
> it gets
> called by "make tests", which is plural because "make test" builds _this_
> command standalone.) is that the second half of the test file is a bunch of
> comments of tests I should add to it.
>
> Specifically, THIS one falls under:
>
> # TODO: Test rwx gu t
>
> And it's not -t (that's is a TTY), it's -k to test the sticky bit, which I
> don't
> seem to have implemented?
>
> Ok, try now?
>
> Thanks,
>
> Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20201125/20a9dcb3/attachment-0001.htm>
More information about the Toybox
mailing list