autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GNU Autoconf 2.60] testsuite: 3 120 failed


From: Paul Eggert
Subject: Re: [GNU Autoconf 2.60] testsuite: 3 120 failed
Date: Wed, 11 Oct 2006 14:52:13 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Stepan Kasal <address@hidden> writes:

> 3) AS_EXECUTABLE_P is reduced to `test -x' (on modern hosts).
> (See the attached autoconf-20061009-bin-sh-3.patch.)
> IIRC, the current implementation of AS_EXECUTABLE_P is a result of a
> long discussion.  In particular, mere `test -x' was refused because
> it is true for a directory, and one might encounter a directory named
> `perl' somewhere in PATH.

OK, but we should still have a macro that expands to plain "test -x",
since sometimes it is useful to test whether the installer has the
x permission on a file or directory or whatever.

I installed this patch instead; it preserves the semantics of
AS_EXECUTABLE_P and adds a new macro AS_TEST_X that behaves like "test -x".

2006-10-11  Paul Eggert  <address@hidden>

        * lib/m4sugar/m4sh.m4 (AS_TEST_X): New macro.
        (AS_EXECUTABLE_P): Use as_test_x rather than as_executable_p.
        (_AS_TEST_PREPARE): Set as_test_x rather than as_executable_p.
        Use a better substitute, by inspecting the output of "ls"
        rather than just using ":".
        * lib/autoconf/general.m4 (_AC_LINK_IFELSE): Use AS_TEST_X
        rather than AS_EXECUTABLE_P, since we needn't worry about
        non-regular files here.

--- lib/autoconf/general.m4     6 Oct 2006 17:43:55 -0000       1.933
+++ lib/autoconf/general.m4     11 Oct 2006 21:40:04 -0000
@@ -2394,7 +2394,7 @@ AS_IF([_AC_DO_STDERR($ac_link) && {
         test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest$ac_exeext &&
-       AS_EXECUTABLE_P([conftest$ac_exeext])],
+       AS_TEST_X([conftest$ac_exeext])],
       [$2],
       [_AC_MSG_LOG_CONFTEST
        $3])
--- lib/m4sugar/m4sh.m4 11 Oct 2006 19:35:57 -0000      1.197
+++ lib/m4sugar/m4sh.m4 11 Oct 2006 21:40:04 -0000
@@ -784,12 +784,21 @@ fi
 ])# _AS_DIRNAME_PREPARE
 
 
+# AS_TEST_X
+# ---------
+# Check whether a file has executable or search permissions.
+m4_defun([AS_TEST_X],
+[AS_REQUIRE([_AS_TEST_PREPARE])dnl
+$as_test_x $1[]dnl
+])# AS_EXECUTABLE_P
+
+
 # AS_EXECUTABLE_P
 # ---------------
-# Check whether a file is executable.
+# Check whether a file is a regular file that has executable permissions.
 m4_defun([AS_EXECUTABLE_P],
 [AS_REQUIRE([_AS_TEST_PREPARE])dnl
-{ test -f $1 && $as_executable_p $1; }dnl
+{ test -f $1 && AS_TEST_X([$1]); }dnl
 ])# AS_EXECUTABLE_P
 
 
@@ -1019,13 +1028,37 @@ esac[]dnl
 
 # _AS_TEST_PREPARE
 # ----------------
-# Find out ahead of time whether ``test -x'' can be used to distinguish
-# executables from other regular files.
+# Find out whether `test -x' works.  If not, prepare a substitute
+# that should work well enough for most scripts.
+#
+# Here are some of the problems with the substitute.
+# The 'ls' tests whether the owner, not the current user, can execute/search.
+# The eval means '*', '?', and '[' cause inadvertent file name globbing
+# after the 'eval', so jam together as many tokens as we can to minimize
+# the likelihood that the inadvertent globbing will actually do anything.
+# Luckily, this gorp is needed only on really ancient hosts.
+#
 m4_defun([_AS_TEST_PREPARE],
 [if test -x / >/dev/null 2>&1; then
-  as_executable_p='test -x'
+  as_test_x='test -x'
 else
-  as_executable_p=:
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$[]1"; then
+        test -d "$[]1/.";
+      else
+       case $[]1 in
+        -*)set "./$[]1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$[]1" 2>/dev/null` in
+       ???[[sx]]*):;;*)false;;esac;fi
+    '\'' sh
+  '
 fi
 ])# _AS_TEST_PREPARE
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]