Hi Tim, Paul, thanks for the report.

Tim Rice wrote:
> 
> On my UnixWare 7.1.4 box, the tests get stuck on
>  75: Configure re-execs self with CONFIG_SHELL
> 
> I'll try to do some more debugging in a couple of days.

Paul Eggert wrote:
> autoconf 2.68b loops on Solaris 10 sparc (test 75)
>
> The symptoms are:
>
> $ cd tests; make check TESTSUITEFLAGS=75
> make  check-local
> /bin/bash ./testsuite 75
> ## ------------------------------ ##
> ## GNU Autoconf 2.68b test suite. ##
> ## ------------------------------ ##
> 75: Configure re-execs self with CONFIG_SHELL
>
> and it hangs until I do a ^C.

I can reproduce the issues with dash-0.5.2:

  $ echo 'AC_INIT(x,0)' > configure.ac
  $ autoconf-2.68b
  $ CONFIG_SHELL=/opt/extra/bin/dash-0.5.2 ./configure # Loops
  ^C

It seems to me that the problem happens only with shells that do not
expand $LINENO, for which the rewrite-and-sourcing of configure.lineno
messes up our guard against infinite recursion.  The attached patch
should fix that.  OK for master?

Thanks,
  Stefano

>From cca288d94e1d1992dd157e43c5891213c87b46be Mon Sep 17 00:00:00 2001
Message-Id: <cca288d94e1d1992dd157e43c5891213c87b46be.1330767922.git.stefano.lattar...@gmail.com>
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Sat, 3 Mar 2012 10:44:25 +0100
Subject: [PATCH] configure: don't infloop when re-executing with
 $CONFIG_SHELL

It turns out our guard against infinite recursion wasn't good
enough when shells without $LINENO support were involved, since
the creation-and-sourcing of configure.lineno broke the guard's
expectations.  Reports by Tim Rice and Paul Eggert.

* lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Export '_as_can_reexec'
to "no" before sourcing the just-created configure.lineno.
---
 lib/m4sugar/m4sh.m4 |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index be013aa..f05346b 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -1199,6 +1199,10 @@ dnl Eggert wrote the scripts with optimization help from Paolo Bonzini).
   chmod +x "$as_me.lineno"] ||
     AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell])
 
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
-- 
1.7.9

Reply via email to