Chet Ramey wrote:
> The configure test for /dev/fd succeeds on FreeBSD
> (testing for /dev/fd/3 after `exec 3</dev/null'), when it should fail.
> It should only succeed if you have the fdescfs file system mounted.
> The problem is that `configure' concludes that /bin/sh's $LINENO
> handling is deficient and uses bash to execute the configure script.
> The bash builtin `test' interprets pathnames beginning with /dev/fd
> internally, using fstat on the appropriate file descriptor, so this
> test succeeds.
>
> This should affect only FreeBSD 5 and 6.
>
> You can fix this in a couple of ways: Edit config.h to #undef
> HAVE_DEV_FD after configure finishes, or set `CONFIG_SHELL=/bin/sh'
> before running configure.
>
> I will need to figure out a better test for future versions.
Attached is a patch to aclocal.m4 (and the auto-generated
configure) that finds the test binary and runs that directly for this
test only.
Fixes the described issue nicely on Gentoo/FreeBSD-6
We also change the test to -e instead of -r due to Gentoo Bug
http://bugs.gentoo.org/show_bug.cgi?id=131875
Thanks
Roy
--- bash-3.2.orig/aclocal.m4 2006-09-12 22:18:07.000000000 +0100
+++ bash-3.2/aclocal.m4 2006-12-31 10:51:39.000000000 +0000
@@ -1538,13 +1538,18 @@
])
AC_DEFUN(BASH_CHECK_DEV_FD,
-[AC_MSG_CHECKING(whether /dev/fd is available)
+[AC_PATH_PROG(TEST, test, test)
+AC_MSG_CHECKING(whether /dev/fd is available)
AC_CACHE_VAL(bash_cv_dev_fd,
[bash_cv_dev_fd=""
if test -d /dev/fd && test -r /dev/fd/0 < /dev/null; then
# check for systems like FreeBSD 5 that only provide /dev/fd/[012]
exec 3</dev/null
- if test -r /dev/fd/3; then
+ # Sadly, if bash is used as the configure shell then the below test is
+ # always true on FreeBSD where it needs to be false. This is due to bash's
+ # internal handling on test on /dev/fd. The test binary should always work
+ # properly here.
+ if $TEST -e /dev/fd/3; then
bash_cv_dev_fd=standard
else
bash_cv_dev_fd=absent
--- bash-3.2.orig/configure 2006-12-31 11:08:23.000000000 +0000
+++ bash-3.2/configure 2006-12-31 11:30:52.000000000 +0000
@@ -27169,6 +27169,46 @@
fi
+# Extract the first word of "test", so it can be a program name with args.
+set dummy test; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_TEST+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $TEST in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_TEST="$TEST" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_TEST="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_TEST" && ac_cv_path_TEST="test"
+ ;;
+esac
+fi
+TEST=$ac_cv_path_TEST
+if test -n "$TEST"; then
+ echo "$as_me:$LINENO: result: $TEST" >&5
+ echo "${ECHO_T}$TEST" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+ echo "${ECHO_T}no" >&6
+fi
+
echo "$as_me:$LINENO: checking whether /dev/fd is available" >&5
echo $ECHO_N "checking whether /dev/fd is available... $ECHO_C" >&6
@@ -27179,7 +27219,11 @@
if test -d /dev/fd && test -r /dev/fd/0 < /dev/null; then
# check for systems like FreeBSD 5 that only provide /dev/fd/[012]
exec 3</dev/null
- if test -r /dev/fd/3; then
+ # Sadly, if bash is used as the configure shell then the below test is
+ # always true on FreeBSD where it needs to be false. This is due to bash's
+ # internal handling on test on /dev/fd. The test binary should always work
+ # properly here.
+ if $TEST -e /dev/fd/3; then
bash_cv_dev_fd=standard
else
bash_cv_dev_fd=absent
_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash