[patch] prevent BASH env pollution from corrupting AC_PATH_PROG(bash) search
the configure script searches for `bash` so that it can put it into bash
scripts (like ldd) via @BASH@:
AC_PATH_PROG(BASH, bash, no)
this means try to locate the program "bash" in $PATH and set the variable
$BASH to it when found. but if the variable $BASH is already set, skip any
search and just use that.
bash has a neat feature where it automatically sets the variable $BASH to how
it was invoked:
$ /bin/sh -c 'echo $BASH'
$ /bin/bash -c 'echo $BASH'
$ ln -s /bin/bash mooooooo
$ ./mooooooo -c 'echo $BASH'
this causes the aforementioned test to be troublesome when:
- /bin/sh is set to /bin/bash
- glibc is compiled and /bin/sh is recorded in /usr/bin/ldd
- /bin/sh is switched to say /bin/dash
- ldd fails due to it not being POSIX compliant shell code
i'd propose ldd be tweaked to be POSIX compliant, but that idea was shot down
back in January of this year ... so instead, i'll propose tweaking the
configure script so that the internal bash env pollution doesnt break the
intent of the AC_PATH_PROG(bash) test
-AC_PATH_PROG(BASH, bash, no)
+dnl bash will set $BASH automatically to $0, so use $BASH_SHELL
+AC_PATH_PROG(BASH_SHELL, bash, no)
if test "$BASH" != no &&
$BASH -c 'test "$BASH_VERSINFO" \
&& test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then