[Top][All Lists]

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

proposed patch for "Tests failed with LINENO." Autoconf bug

From: Paul Eggert
Subject: proposed patch for "Tests failed with LINENO." Autoconf bug
Date: Thu, 25 Oct 2001 18:02:26 -0700 (PDT)

I verified that my bug does not occur if I use 5.005_03 instead of
5.005_02.  So requiring Perl 5.005_03 or later seems like a good idea.
Is that easy to do?

I also verified that pascal.bart's bug does not occur if I install
Bash 2.04 as /bin/bash (which causes CONFIG_SHELL to equal /bin/bash
rather than /bin/ksh).  So this seems to be a compatibility issue with
Solaris 2.5.1 /bin/ksh.

I looked into the problem a bit more, and traced it down to two
different bugs:

1. The awk solution that substitutes $LINENO does not work for the
   "testsuite" command.  Some occurrences of the string "$LINENO" in
   "testsuite" should not be substituted for, because "testsuite"
   wants the string to not be evaluated by "testsuite" itself, but by
   a subsidiary process.

2. The LINENO test in "testsuite" is too stringent; it rejects Solaris
   2.5.1 /bin/ksh even though /bin/ksh has adequate LINENO support.
   The problem is that Solaris 2.5.1 /bin/ksh does not increment
   $LINENO inside an eval'ed string.  But Autoconf does not rely on
   that particular feature (nor is it clear to me that the 2.5.1
   behavior is incorrect, and frankly I'm puzzled that we haven't run
   into this problem elsewhere).  Anyway, we shouldn't test for it.

Here is a patch for (2); it fixes pascal.bart's bug for me on Solaris 2.5.1,
and "make check" succeeds cleanly.

(As you know, I'm dubious about the 'awk' approach because I think
 we'll keep running into problems with it, but please feel free to fix
 (1) if you like.  :-)

2001-10-25  Paul Eggert  <address@hidden>

        * lib/m4sugar/m4sh.m4 (_AS_LINENO_WORKS): New macro.
        (_AS_LINENO_PREPARE): Use it instead of shell eval, to work
        around an incompatibility with Solaris 2.5.1 /bin/ksh.

diff -pru autoconf/lib/m4sugar/m4sh.m4 tmp/lib/m4sugar/m4sh.m4
--- autoconf/lib/m4sugar/m4sh.m4        Thu Oct 18 17:14:57 2001
+++ tmp/lib/m4sugar/m4sh.m4     Thu Oct 25 17:31:45 2001
@@ -459,6 +459,17 @@ else
+# ---------------
+# Succeed if the currently executing shell supports LINENO.
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"
 # ------------------
@@ -473,16 +484,7 @@ fi
 # it protects us from repetitive rewrites.  Be sure to have a test
 # that does detect non LINENO support...
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2"
-if eval "$as_command"; then
-  :
   # Find who we are.  Look in the path if we contain no path at all
   # relative or not.
   case $[0] in
@@ -505,7 +507,7 @@ else
       [for as_base in sh bash ksh sh5; do
         case $as_dir in
-          if ("$as_dir/$as_base" -c "$as_command") 2>/dev/null; then
+          if ("$as_dir/$as_base" -c '_AS_LINENO_WORKS') 2>/dev/null; then
             export CONFIG_SHELL
             exec "$CONFIG_SHELL" "$[0]" ${1+"address@hidden"}
@@ -533,7 +535,7 @@ else
   . ./$as_me.lineno
   # Exit status is that of the last command.

reply via email to

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