[Toybox] macOS sed

Rob Landley rob at landley.net
Wed Nov 28 15:04:26 PST 2018


On 11/28/18 3:42 PM, enh via Toybox wrote:
> according to https://stackoverflow.com/questions/12272065/sed-undefined-label-on-macos
> macOS' sed only lets you branch backwards. this breaks mkflagsh and
> getglobals in scripts/make.sh.
> 
> i'm assuming the answer is "you'll need `brew install gnu-sed` to
> bootstrap, and can use a toybox sed from then on", but should we give
> a clearer error? something like "if you're on macOS but i can't find
> gsed, suggest `brew install`"?

Aha. That's why it had $SED.

Wait, where in posix says you can only branch _backwards_? :label is a label you
can jump to, it doesn't say it has to have already encountered it in the script.
(Did I miss a curve in the reading again? I thought I'd read that one REALLY
CLOSELY, although once again time has managed to go by since then...)

Anyway, I'm happy to give a clearer error. _How_? (What does "uname -o" say on a
mac?) At the very leas I can make $SED default to "gsed" when [[ "$(uname -o")
=~ Mac ]]  or some such, then at least the error is gsed missing. But that
assumes I'm detecting MacOS...

Rob

P.S. My commit to add an extra symlink dereferencing layer so you can alias
command names, this is one of the things I had vaguely in mind. So toybox can
provide _gsed_ for scripts that care. Toybox's build can't be the _only_ one on
macosx...



More information about the Toybox mailing list