[Toybox] awk (was: strlower() bug)

Ray Gardner raygard at gmail.com
Wed Jun 19 17:18:39 PDT 2024


On Sun, Jun 16, 2024 at 7:29 AM Rob Landley <rob at landley.net> wrote:
>
> On 6/15/24 17:22, Ray Gardner wrote:
>
> > But you've been looking for an awk for at least 8 years, so I really
> > thought you'd welcome one that's complete and written for toybox, with
> > some tests and documentation.
>
> I am very interested, yes.
>
> I downloaded your repo, copied toybox/awk.c to toys/pending/awk, and built it.
> It compiled. I grabbed awk.test and ran that, and it passed.
>
> Didn't QUITE pass test_host:
>
> awk: cmd. line:1: warning: escape sequence `\u' treated as plain `u'
> FAIL: awk \u
> echo -ne '' | "/usr/bin/awk" 'BEGIN{print "\u20\u255"}' < /dev/null
> --- expected    2024-06-16 08:36:12.147722288 -0500
> +++ actual      2024-06-16 08:36:12.155722288 -0500
> @@ -1 +1 @@
> - ɕ
> +u20u255

It passes all tests on my system with TEST_HOST=1, when I set up gawk
5.3.0 as my default awk.

> But eh, passed all the others (with VERBSOSE=all), close enough. (Adding
> "utf8locale" to the test file didn't fix it, dunno what it's trying to do...)

The \u escape is non-posix and may not be supported in older
implementations. And no two implementations do everything alike.

What is your host version of awk? The message looks like it's from some
version of gawk.

> *shrug* I'm happy to check it into pending as is, if you don't mind discarding
> commit history. (Um, URL to the github commit I got it from maybe? The trees
> haven't got the same base so there isn't an obvious "pull" option here...)

I'm fine with any way you can get this into toybox. I assume I'll keep
sending patches as I get things fixed. I have one user saying it's not
working right with interactive scripts that read stdin from terminal.
I'm going to try to fix that soon.


More information about the Toybox mailing list