autoconf-commit
[Top][All Lists]
Advanced

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

[SCM] GNU Autoconf source repository branch, master, updated. v2.68-142-


From: Eric Blake
Subject: [SCM] GNU Autoconf source repository branch, master, updated. v2.68-142-gff30112
Date: Mon, 27 Feb 2012 20:00:27 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Autoconf source repository".

http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=ff3011217dc8bf66fc8f355f18436d1b3ab6a575

The branch, master has been updated
       via  ff3011217dc8bf66fc8f355f18436d1b3ab6a575 (commit)
       via  9e4e0a37d7b7200f671c2eadb3478a77d2dd7c9c (commit)
       via  8798792f568d7cdfb0815d249fe6a718d6877708 (commit)
      from  fed83ed994ecc931769de2fa579ab4aec89028bd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ff3011217dc8bf66fc8f355f18436d1b3ab6a575
Author: Eric Blake <address@hidden>
Date:   Sat Feb 25 07:14:29 2012 -0700

    tests: add test for AS_EXECUTABLE_P
    
    Now that this is public, we should regression test it.
    
    * tests/m4sh.at (AS@&address@hidden): New test.
    
    Signed-off-by: Eric Blake <address@hidden>

commit 9e4e0a37d7b7200f671c2eadb3478a77d2dd7c9c
Author: Eric Blake <address@hidden>
Date:   Fri Feb 24 21:54:39 2012 -0700

    m4sh: make AS_EXECUTABLE_P public
    
    In the process of making it public, factor it into a reusable
    function.  This makes constructs like AC_CHECK_PROGRAM smaller,
    as well as making libtool's naughty use of $as_executable_p safer.
    
    * lib/m4sugar/m4sh.m4 (_AS_TEST_PREPARE): Add a shell function.
    (AS_EXECUTABLE_P): Forward to shell function.
    * doc/autoconf.texi (Common Shell Constructs): Document it.
    * NEWS: Mention this.
    
    Signed-off-by: Eric Blake <address@hidden>

commit 8798792f568d7cdfb0815d249fe6a718d6877708
Author: Eric Blake <address@hidden>
Date:   Fri Feb 24 21:09:34 2012 -0700

    m4sh: require that 'test -x' works
    
    4.3BSD is no longer a reasonable portability target; and we are
    pretty sure that these days we can find at least one shell on any
    platform that supports 'test -x'.  Drop a horribly unsafe use of
    eval as a result. :)
    
    Libtool still uses $as_executable_p without so much as calling
    either AS_TEST_X or AS_EXECUTABLE_P; even though the latter has
    existed, although undocumented, since at least 2.59; furthermore,
    libtool uses it in a context where filtering out directories
    would have been desirable.  Shame on them.
    
    * lib/m4sugar/m4sh.m4 (_AS_TEST_X_WORKS): New probe.
    (AS_SHELL_SANITIZE, AS_INIT): Use it in shell searching.
    (AS_TEST_X, AS_EXECUTABLE_P): Simplify.
    
    Signed-off-by: Eric Blake <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 NEWS                |    2 +
 doc/autoconf.texi   |    7 ++++++
 lib/m4sugar/m4sh.m4 |   55 +++++++++++++++++---------------------------------
 tests/m4sh.at       |   52 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 80 insertions(+), 36 deletions(-)

diff --git a/NEWS b/NEWS
index decad47..1a5f775 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,8 @@ GNU Autoconf NEWS - User visible changes.
 ** AS_LITERAL_IF again treats '=' as a literal.  Regression introduced in
    2.66.
 
+** The macro AS_EXECUTABLE_P, present since 2.50, is now documented.
+
 ** Macros
 
 - AC_PROG_LN_S and AS_LN_S now fall back on 'cp -pR' (not 'cp -p') if 'ln -s'
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 9c75ab0..83f24ba 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -13658,6 +13658,13 @@ m4_bpatsubst(address@hidden, ['], ['\\''])
 @end example
 @end defmac
 
address@hidden AS_EXECUTABLE_P (@var{file})
address@hidden
+Emit code to probe whether @var{file} is a regular file with executable
+permissions (and not a directory with search permissions).  The caller
+is responsible for quoting @var{file}.
address@hidden defmac
+
 @defmac AS_EXIT (@dvar{status, $?})
 @asindex{EXIT}
 Emit code to exit the shell with @var{status}, defaulting to @samp{$?}.
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 5d01f55..91fc0fb 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -513,6 +513,7 @@ m4_define([AS_SHELL_SANITIZE],
 m4_provide_if([AS_INIT], [],
 [m4_provide([AS_INIT])
 _AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])
+_AS_DETECT_REQUIRED([_AS_TEST_X_WORKS])
 _AS_DETECT_BETTER_SHELL
 _AS_UNSET_PREPARE
 ])])
@@ -1084,9 +1085,11 @@ fi
 # AS_TEST_X
 # ---------
 # Check whether a file has executable or search permissions.
+# FIXME: This macro is no longer useful; consider deleting it in 2014
+# after we ensure m4sh scripts can always find a shell with test -x.
 m4_defun_init([AS_TEST_X],
 [AS_REQUIRE([_AS_TEST_PREPARE])],
-[$as_test_x $1[]])# AS_TEST_X
+[test -x $1[]])# AS_TEST_X
 
 
 # AS_EXECUTABLE_P
@@ -1094,7 +1097,7 @@ m4_defun_init([AS_TEST_X],
 # Check whether a file is a regular file that has executable permissions.
 m4_defun_init([AS_EXECUTABLE_P],
 [AS_REQUIRE([_AS_TEST_PREPARE])],
-[{ test -f $1 && AS_TEST_X([$1]); }])# AS_EXECUTABLE_P
+[as_fn_executable_p $1])# AS_EXECUTABLE_P
 
 
 # _AS_EXPR_PREPARE
@@ -1365,43 +1368,22 @@ m4_define([AS_SET_CATFILE],
 esac[]])# AS_SET_CATFILE
 
 
+# _AS_TEST_X_WORKS
+# ----------------
+# These days, we require that `test -x' works.
+m4_define([_AS_TEST_X_WORKS], [test -x /])
+
 # _AS_TEST_PREPARE
 # ----------------
-# 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.
-#
+# Provide back-compat to people that hooked into our undocumented
+# internals (here's looking at you, libtool).
 m4_defun([_AS_TEST_PREPARE],
-[if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  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
-dnl as_executable_p is present for backward compatibility with Libtool
-dnl 1.5.22, but it should go away at some point.
-as_executable_p=$as_test_x
+[AS_REQUIRE_SHELL_FN([as_fn_executable_p],
+  [AS_FUNCTION_DESCRIBE([as_fn_executable_p], [FILE],
+    [Test if FILE is an executable regular file.])],
+  [  test -f "$[]1" && test -x "$[]1"])]dnl
+[as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 ])# _AS_TEST_PREPARE
 
 
@@ -2177,5 +2159,6 @@ m4_divert_text([M4SH-INIT-FN], [m4_text_box([M4sh Shell 
Functions.])])
 m4_divert([BODY])dnl
 m4_text_box([Main body of script.])
 _AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl
+_AS_DETECT_REQUIRED([_AS_TEST_X_WORKS])dnl
 AS_REQUIRE([_AS_UNSET_PREPARE], [], [M4SH-INIT-FN])dnl
 ])
diff --git a/tests/m4sh.at b/tests/m4sh.at
index e9da403..38667e4 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -552,6 +552,58 @@ AT_CLEANUP
 
 
 
+## ----------------- ##
+## AS_EXECUTABLE_P.  ##
+## ----------------- ##
+
+# Check for executable regular files.
+AT_SETUP([AS@&address@hidden)
+AT_KEYWORDS([m4sh])
+
+AT_DATA_M4SH([script.as],
+[[AS_INIT
+
+if AS_EXECUTABLE_P([/]); then
+  echo fail
+else
+  echo 1
+fi
+cat > foo.sh <<\EOF || AS_EXIT([1])
+#/bin/sh
+exit 0
+EOF
+# File systems like FAT tend to fake executable permissions on all files.
+# At this point, foo.sh should be executable iff permissions are faked.
+AS_EXECUTABLE_P([foo.sh])
+st1=$?
+(./foo.sh) >/dev/null 2>&1
+st2=$?
+case $st1:$st2 in
+  1:126 | 0:0 ) echo 2 ;;
+  *) echo "fail ($st1:$st2)" ;;
+esac
+# Now things better be executable
+chmod a+x foo.sh || AS_EXIT([2])
+mkdir 'two  spaces' || AS_EXIT([3])
+'two  spaces'/../foo.sh || AS_EXIT([4])
+if AS_EXECUTABLE_P(["two  spaces/../foo.sh"]); then
+  echo 3
+else
+  echo fail
+fi
+]])
+
+AT_CHECK_M4SH
+AT_CHECK([$CONFIG_SHELL ./script], [],
+[[1
+2
+3
+]])
+
+AT_CLEANUP
+
+
+
 ## --------- ##
 ## AS_EXIT.  ##
 ## --------- ##


hooks/post-receive
-- 
GNU Autoconf source repository



reply via email to

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