[Toybox] Bash Compatibility Patch
Rob Landley
rob at landley.net
Sat Jun 29 10:39:03 PDT 2019
On 6/29/19 7:52 AM, Eric Molitor wrote:
> I know that you are working on toysh which I'm looking forward to. In the
> meantime below is a patch to improve compatibility with older/odd versions of
> bash. This fixed a minor build issue I was having on MacOS (which was using zsh
> in emulated bash mode) as well as an oddball embedded SDK using a non-gnu
> version of bash. I believe these changes are minimal and should be safe to
> apply, if not I wanted to at least get them on the mailing list in case others
> ran into these issues.
I applied this, on the theory you have a testing environment I don't and I
didn't cause me obvious regressions when I tried it, but I'm not happy with it.
> -if [ generated/mkflags -ot scripts/mkflags.c ]
> +if [ ! -f generated/mkflags ] || [ generated/mkflags -ot scripts/mkflags.c ]
In which bash version does comparing a file that doesn't exist return true?
> if [ -z "$SED" ]
> then
> - [ ! -z "$(which gsed 2>/dev/null)" ] && SED=gsed || SED=sed
> + [ ! -z "$(command -v gsed 2>/dev/null)" ] && SED=gsed || SED=sed
> fi
Toybox provides a which this works with. What problem did you hit?
Rob
More information about the Toybox
mailing list