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

Rob Landley rob at landley.net
Fri Oct 30 19:22:58 PDT 2020



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.

> 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?

> 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.

Rob



More information about the Toybox mailing list