]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* tests/tools.m4 (Syntax of the scripts): Be robust to shells that
authorAkim Demaille <akim@epita.fr>
Fri, 18 Feb 2000 09:25:46 +0000 (09:25 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 18 Feb 2000 09:25:46 +0000 (09:25 +0000)
never return on some `/bin/sh -n foo.sh'.
Reported by Nicolas Joly.

ChangeLog
THANKS
tests/tools.m4

index 59f16a6d69dfd53abd6206e598fbc0fb5991e617..56d613e4b52290d40b6d2bd7fa6df3205c0b21be 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-02-18  Akim Demaille  <akim@epita.fr>
+
+       * tests/tools.m4 (Syntax of the scripts): Be robust to shells that
+       never return on some `/bin/sh -n foo.sh'.
+       Reported by Nicolas Joly.
+
 2000-02-17  Akim Demaille  <akim@epita.fr>
 
        Move the documentation into doc/.
diff --git a/THANKS b/THANKS
index 906f12b9d0ff2a6cb38bd1397b2e79901eadf578..4026417513b565c019e804d49efd170602f22e54 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -43,6 +43,7 @@ Markku Savela         msa@msa.tte.vtt.fi
 Matthew D. Langston    langston@SLAC.Stanford.EDU
 Mike Stump             mrs@wrs.com
 Miles Bader            miles@gnu.ai.mit.edu
+Nicolas Joly           njoly@pasteur.fr
 Noah Friedman          friedman@gnu.ai.mit.edu
 Paul Eggert            eggert@twinsun.com
 Pavel Roskin           pavel_roskin@geocities.com
index a96a29f9248bdab3f3311dc056927b21c52f591d..c19c890f078a697c6a158463aff2f87cbdd75aef 100644 (file)
@@ -11,16 +11,47 @@ EOF
 ## Check that the shell scripts are syntactically correct.  ##
 ## -------------------------------------------------------- ##
 
+# We use `/bin/sh -n script' to check that there are no syntax errors
+# in the scripts.  Although incredible, there are /bin/sh that go into
+# endless loops with `-n', e.g., SunOS's:
+#
+#   $ uname -a
+#   SunOS ondine 4.1.3 2 sun4m unknown
+#   $ cat endless.sh
+#   while false
+#   do
+#     :
+#   done
+#   exit 0
+#   $ time sh endless.sh
+#   sh endless.sh  0,02s user 0,03s system 78% cpu 0,064 total
+#   $ time sh -nx endless.sh
+#   ^Csh -nx endless.sh  3,67s user 0,03s system 63% cpu 5,868 total
+#
+# So before using `/bin/sh -n' to check our scripts, we first check
+# that `/bin/sh -n' is not broken to death.
+
 AT_SETUP(Syntax of the scripts)
 
-AT_DATA(true,
-[[#! /bin/sh
-exit 0
+# A script that never returns.  We don't care that it never returns,
+# broken /bin/sh loop equally with `false', but it makes it easier to
+# test the robusteness in a good environment: just remove the `-n'.
+AT_DATA(endless.sh,
+[[while true
+do
+  :
+done
 ]])
 
-chmod +x true
+# A script in charge of testing `/bin/sh -n'.
+AT_DATA(syntax.sh,
+[[set -e
+(/bin/sh -n endless.sh) &
+cpid=$!
+sleep 2 && kill $cpid >/dev/null 2>&1
+]])
 
-if (/bin/sh -n ./true) >/dev/null 2>&1; then
+if /bin/sh ./syntax.sh; then
   AT_CHECK([/bin/sh -n ../autoconf],   0)
   AT_CHECK([/bin/sh -n ../autoreconf], 0)
   AT_CHECK([/bin/sh -n ../autoupdate], 0)