[Toybox] [PATCH] Make it easier to switch regex implementations.

enh enh at google.com
Mon Nov 2 11:55:01 PST 2020


On Fri, Oct 30, 2020 at 7:12 PM Rob Landley <rob at landley.net> wrote:
>
>
>
> On 10/28/20 7:06 PM, enh via Toybox wrote:
> > One reason to use toybox on the host is to get the same behavior across
> > Android/Linux/macOS. Unfortunately (as we've seen from a few bugs) one
> > area where that doesn't quite work is that toybox uses the libc regular
> > expression implementation.
>
> Which another reason the version of toybox you distribute should be statically
> linked against bionic.

aye, but "host bionic" is a longer project with no-one funded to work on it.

> > That's fine, and mostly what users want, but
> > those folks trying to get the exact same behavior everywhere might want
> > to switch in a known regex implementation (bionic's NetBSD regex
> > implementation, say) for increased consistency.
>
> By statically linking the binaries against bionic. :)
>
> (Did you ever fix the "hello world segfaults in a chroot that doesn't have
> /dev/null because bionic's _start code does a lot with no error checking" issue?

no, that's actually a deliberate crash. that's definitely not a
supported _device_ configuration, and we deliberately minimize the
differences between host and device. (it's 99% of the point of having
host bionic in the first place!)

> > That actually works pretty well, but portability.h has an #ifndef test
> > for REG_STARTEND before including <regex.h> that gets in the way. To
> > make up for that, this patch removes the unnecessary #include <regex.h>
> > from grep.c itself.
>
> Applied, but it's one measure of a whack-a-mole problem space.

there's never going to be a "host bionic for macOS" anyway, so this is
necessary if not sufficient.

unfortunately, something (presumably a kernel or file system change)
seems to have broken a dd test on cuttlefish, so that's the next thing
i need to look at when i can find some time:

FAIL: dd sync,noerror
echo -ne "I WANT\n" > input
echo -ne '' | dd if=input of=outFile seek=8860 bs=1M conv=sync,noerror
2>/dev/null &&
   stat -c "%s" outFile && rm -f outFile
--- expected 2020-10-29 16:10:58.647991948 -0500
+++ actual 2020-10-29 16:10:58.667991947 -0500
@@ -1 +1 @@
-9291431936
+701497344


> Rob


More information about the Toybox mailing list