[Toybox] [PATCH 2/2] macOS: use -E rather than -r for sed extended regular expressions.

enh enh at google.com
Wed Nov 28 15:08:20 PST 2018


On Wed, Nov 28, 2018 at 2:45 PM Rob Landley <rob at landley.net> wrote:
>
> On 11/28/18 2:16 PM, enh via Toybox wrote:
> > GNU sed supports -E, -r, and --regexp-extended. BSD sed only supports
> > -r.
> > ---
> >  scripts/genconfig.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/genconfig.sh b/scripts/genconfig.sh
> > index 533df60..3887b07 100755
> > --- a/scripts/genconfig.sh
> > +++ b/scripts/genconfig.sh
> > @@ -144,7 +144,7 @@ genconfig > generated/Config.in || rm generated/Config.in
> >  toys()
> >  {
> >    grep 'TOY(.*)' "$@" | grep -v TOYFLAG_NOFORK | grep -v "0))" | \
> > -    sed -rn 's/([^:]*):.*(OLD|NEW)TOY\( *([a-zA-Z][^,]*) *,.*/\1:\3/p'
> > +    sed -En 's/([^:]*):.*(OLD|NEW)TOY\( *([a-zA-Z][^,]*) *,.*/\1:\3/p'
> >  }
>
> Applied, but this raises the question of whether $SED in make.sh is still
> needed? (I applied a patch from a macos dev who said it worked, I had a mac but

(i don't --- i'm just borrowing one to see how realistic getting a mac
toybox binary is. the answer seems to be that it's not _too_ bad,
though there are linuxy tentacles even in things like cp and tail. but
for my money, just having all our builds use the exact same sed would
still be a win.)

> my apple store subscription was so screwed up an hour from a mac expert who knew
> where the secret hidden error logs were couldn't get it unborked. I break
> everything. Anyway, there patch used "gsed" instead of "sed", which is gnu sed.
> The above wasn't using that because I forgot. :)
>
> If we don't need gsed, then $SED should probably be removed...

see my other mail. if you agree to the suggestion of an error, i'll
send you another patch that adds an error if you're on a mac and not
using gsed, and switches this to $SED.

> Rob



More information about the Toybox mailing list