[Toybox] patch and fuzz

Rob Landley rob at landley.net
Fri Jul 31 02:41:26 PDT 2020


On 7/30/20 7:25 PM, enh wrote:
> well, you were right that i'd notice _eventually_, but i hadn't been
> keeping up thanks to a couple of weeks mainly spent replaying the
> Uncharted games :-)

My toybox time has been devoted almost entirely to getting toysh to a good
stopping point before I get sucked back into j-core dayjob stuff when the next
round of hardware arrives in the mail.

I've got the basic parsing for ${#a/2/x} style expansions to work (although I
haven't filled them all in yet), and I've swung back to finishing my OTHER open
can of worms which is wildcard parsing. I think I've worked out how:

  $ touch 'AB[DEF]'; echo AB[+(DEF]) AB[+(DEF)? AB+([DEF)]
  AB[+(DEF]) AB[DEF] AB+([DEF)]

Is supposed to work internally now, and am implementing it. (An unfinished [ is
a literal, but a finished [ ] block eats all wildcards within it, meaning you
have to rewind state, but +() contexts can have their own bracket context which
implies you need a stack to store the speculative [ starts that may never be
closed, except they don't CLEANLY nest since [+([x])] is a "[+([x]" single
character match followed by ")]" as two literals so you COULD backtrack in your
metadata array.

Oh, I'm collecting a metadata array to mark active wildcards in the output
because quoting and backslashes and such have been consumed to PRODUCE that
output, so it needs to record whether they were unquoted.

And of course:

  $ echo [$(echo ])
  []

Is because the $ family is parsed _before_ wildcards happen, hence:

  $ X=abc
  $ echo [$X]
  [abc]
  $ touch b
  $ echo [$X]
  b
  $ echo [$(echo abc)]
  b

Which is why I need the metadata array. Heck, wildcard evaluation happens after
$IFS splitting, by that point quotes and backslashes are LONG gone or I'd have
to annotate them in the OTHER direction.

Yes, I need tests for all of this. No, I'm not bugging Chet, I suspect the poor
man's had enough. :)

But I admit there's a lot of time reading "a wizard's guide to defensive baking"
and playing the new skyrim character I started recently that could be going to
toybox development, and isn't. (I'm too stressed to function rather a lot these
days.)

And now I'm spending brain cells reading the USB specification documents because
when we get hardware threading and microcoded DMA into the J1 design, I need to
write a USB gadget state machine. The "new hardware arriving" would be the
turtle hat with a
https://lists.j-core.org/pipermail/j-core/2020-June/000921.html on it. And of
course _today_ I was trying to track down the horrible shared libraries the
https://www.bugblat.com/products/minisniff/ driver needs so we can debug the
framing issues in the PREVIOUS round of this stuff, and my current theory is it
wants https://wiki.codelite.org/pmwiki.php/Main/WxWidgets31Binaries for some
reason. Any library with "unofficial" in the .so name should NOT ENABLE GNU
SYMBOL VERSIONING, and if it does then whoever is building binaries against it
should #%*(&#&% STATICALLY LINK THEM already. Sigh, half the appeal of drupal
and flatpack and such would go away if people just remembered that static
linking is a thing...

Rob


More information about the Toybox mailing list