Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ LT_INIT

# A real bash, for "make deb" and the test harness. Not searched into BASH: bash presets
# that to its own path, and macOS /bin/sh is a bash, so the macro never searches (#895).
AS_UNSET([BASH_SHELL])
# BASH_SHELL isn't preset the way BASH is, so AC_ARG_VAR needs no guard.
AC_ARG_VAR([BASH_SHELL], [path to a real (non-POSIX-mode) bash])
AC_PATH_PROGS([BASH_SHELL], [bash], [/bin/bash])

# Export LD_LIBRARY_PATH name or equivalent.
Expand Down
44 changes: 44 additions & 0 deletions tests/146_bash-shell.test
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,48 @@ test "$out" = procsub || {
exit 1
}

# Whatever configure picks, an absolute BASH_SHELL from the user must win over the search.
configure="${abs_top_srcdir:-}/configure"
test -r "$configure" || {
echo "no configure script at $configure; tests/Makefile.am must export abs_top_srcdir" >&2
exit 1
}

help=$(bash "$configure" --help)
grep -q '^ *BASH_SHELL ' <<<"$help" || {
echo "configure --help does not advertise BASH_SHELL (AC_ARG_VAR missing)" >&2
exit 1
}

tmp=$(mktemp -d)
trap 'set +e; rm -rf "$tmp"' EXIT
mkdir "$tmp/src" "$tmp/bld"
ln -s "$sh" "$tmp/mybash"

# Symlink farm, not the real srcdir: an in-tree config.status makes autoconf refuse it.
for f in "$abs_top_srcdir"/*; do
case "${f##*/}" in
config.status | config.log | config.h | stamp-h1 | Makefile) continue ;;
esac
ln -s "$f" "$tmp/src/"
done

# Prefer the Makefile: it proves the value that reaches $(BASH_SHELL), not just the macro's
# decision. configure may die on a library check before writing one, so fall back to the
# trace it printed earlier.
(cd "$tmp/bld" && BASH_SHELL="$tmp/mybash" bash "$tmp/src/configure" --disable-https >conf.log 2>&1) || true
if test -f "$tmp/bld/Makefile"; then
got=$(sed -n 's/^BASH_SHELL = //p' "$tmp/bld/Makefile")
from="Makefile"
else
got=$(sed -n 's/^checking for bash\.\.\. //p' "$tmp/bld/conf.log")
got=${got#"(cached) "}
from="trace"
fi
test "$got" = "$tmp/mybash" || {
echo "configure discarded BASH_SHELL=$tmp/mybash, $from has: ${got:-<nothing>}" >&2
tail -20 "$tmp/bld/conf.log" >&2
exit 1
}

echo "configured bash is $sh ($version)"
1 change: 1 addition & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ TESTS_ENVIRONMENT += V6_SUPPORT=$(V6_SUPPORT)
# Asserted by 146_bash-shell.test.
TESTS_ENVIRONMENT += BASH_SHELL=$(BASH_SHELL)
TESTS_ENVIRONMENT += top_srcdir=$(top_srcdir)
TESTS_ENVIRONMENT += abs_top_srcdir=$(abs_top_srcdir)
TESTS_ENVIRONMENT += abs_top_builddir=$(abs_top_builddir)
TESTS_ENVIRONMENT += CONFIGURED_DATADIR=$(datadir)
TESTS_ENVIRONMENT += RENAMEFAIL_LA=$(abs_builddir)/librenamefail.la
Expand Down
Loading