Re: [PATCH 5/6] tests: split up bash detection library
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jan 15, 2021, 09:42 UTC
- Message-ID
- <87lfcu4jv4.fsf@evledraar.gmail.com>
- In-Reply-To
- <20210114233515.31298-6-avarab@gmail.com>
On Fri, Jan 15 2021, Ævar Arnfjörð Bjarmason wrote:
Show 6 quoted lines
> +TEST_SH_IS_BIN_BASH= > +if test -n "$BASH" && test -z "$POSIXLY_CORRECT" > +then > + TEST_SH_IS_BIN_BASH=true > + export TEST_SH_IS_BIN_BASH > +fi
I haven't been able to find from bash's documentation & sources whether this really is the right thing here. I.e. in test-lib.sh we've got an existing test for checking $BASH_VERSION. As far as I can tell it's not documented, but that variable doesn't appear in bash's /bin/sh mode, just in /bin/bash mode.
And then there's $POSIXLY_CORRECT, does that make it 2 modes in total, or 4 (or 3)? I didn't look too carefully, and in any case this worked for all the cases I threw at it of running the tests with /bin/sh or /bin/bash, but it would be a nice follow-up patch to unify this & the other $BASH_VERSION check in test-lib.sh if we could...