[Toybox] toybox tar test failure

Ray Gardner raygard at gmail.com
Mon Jul 15 16:03:15 PDT 2024


On Mon, Jul 15, 2024 at 11:12 AM enh via Toybox
<toybox at lists.landley.net> wrote:
> [snip]
> also (since possibly WAI, and not a blocker because we ignore toybox
> failures in tests if we're not using the toybox implementation), one
> of the awk tests fails against Android's "one true awk":
>
> PASS: awk -f test11.awk
> /system/bin/awk: non-terminated string ... at source line 1 source file test.awk
>  context is
> BEGIN { RS=""; FS=" >>>
>  <<<
> FAIL: awk -f test12.awk
> echo -ne "abc def ghi 5\nghi jkl mno 10\nmno pqr stu 15\nstu vwx abc
> 20\n" > input
> echo -ne '' | "/system/bin/awk" -f test.awk input
> --- expected 2024-07-15 16:18:00.345293604 +0000
> +++ actual 2024-07-15 16:18:00.345293604 +0000
> @@ -1 +0,0 @@
> -ghi jkl mno 10 mno pqr stu 15

Interesting. The problem is not with OTA ("one true awk"), but with
output from the echo in awk.test:

echo "BEGIN { RS=\"\"; FS=\"\n\" } { print \$2,\$3; }" > test.awk

On my machine it creates test.awk as:

BEGIN { RS=""; FS="\n" } { print $2,$3; }

Apparently on yours, it ends the first (only?) line right after the FS="

Does it insert a newline there and continue, or just truncate or what?
I'd like to see your test.awk.

Also, does it help to insert another backslash before the \n, i.e.
FS=\"\\n\" ? For me that creates an identical test.awk.

Is the echo command in awk.test actually wrong?

If that gets OTA past test12.awk, I expect trouble later. At
test24.awk, there is something that looks like:

awk 'BEGIN { printf("foo\n") > "bar" 1 }'

This should write "foo\n" to file bar1, and it does in every awk I
have except OTA (including its latest incarnation). But OTA (aka nawk)
has trouble parsing this. It needs to have parens: ("bar" 1) to work.

You can fix test24.awk using (\"ConcatedFile_a\" i), but then you'll
get later failures with nawk/OTA. In fact, only a recent gawk and my
awk pass all these tests; nawk, mawk, goawk, and busybox awk all have
failures..

It would be great if you could start trying to use toybox awk in place
of OTA and see if you can find problems with it.

BTW I assume "WAI" means "working as intended". right?. Where I
worked, we said WAD, working as designed.

Ray


More information about the Toybox mailing list