git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Stefano Lattarini <stefano.lattarini@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Martin von Zweigbergk <martinvonz@gmail.com>,
	Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [BUG] Infinite make recursion when configure.ac changes
Date: Thu, 21 Feb 2013 01:04:02 -0500	[thread overview]
Message-ID: <20130221060401.GC25943@sigill.intra.peff.net> (raw)
In-Reply-To: <51248D0A.50603@gmail.com>

On Wed, Feb 20, 2013 at 09:44:58AM +0100, Stefano Lattarini wrote:

> From a pristine master checkout:
> 
>   $ make configure && ./configure make
>   ... # All successfull
>   $ touch configure.ac
>   $ make
>     GEN config.status
>   make[1]: Entering directory `/storage/home/stefano/git/src'
>     GEN config.status
>   make[2]: Entering directory `/storage/home/stefano/git/src'
>     GEN config.status
>   make[3]: Entering directory `/storage/home/stefano/git/src'
>     GEN config.status
>   make[4]: Entering directory `/storage/home/stefano/git/src'
>     GEN config.status
>   make[5]: Entering directory `/storage/home/stefano/git/src'
>     GEN config.status
>   ...
> 
> and I have to hit ^C to interrupt that recursion.

I can easily replicate it here.

> This seems due to the change in commit v1.7.12.4-1-g1226504: the
> issue is still present there, but no longer is in the preceding
> commit 7e201053 (a.k.a. v1.7.12.4).
> 
> I haven't investigated this any further for the moment.

Hmm. It looks like config.status depends on configure.ac. So make
rebuilds config.status, which runs "make configure", which includes
"config.mak.autogen", leading "make" to think that it should rebuild the
include file to make sure it is up to date. The include file depends on
"config.status", which needs to be rebuilt due to configure.ac, which
entails running "make configure", and so on.

So the real problem is that make things that "make configure" depends on
"config.mak.autogen" being up to date, which isn't true at all; the
whole point is to make a new configure script so we can write a new
config.mak.autogen. The simplest thing is to just avoid re-running
"make" to get the configure script; the only thing we are gaining is
that we don't have to repeat the build recipe, but we can sneak around
that by sticking it in a variable. Something like this seems to work:

diff --git a/Makefile b/Makefile
index 3b2c92c..ee1c0b0 100644
--- a/Makefile
+++ b/Makefile
@@ -1871,12 +1871,14 @@ configure: configure.ac GIT-VERSION-FILE
 	mv $@+ $@
 endif # NO_PYTHON
 
+CONFIGURE_RECIPE = $(RM) configure configure.ac+ && \
+		   sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+			configure.ac >configure.ac+ && \
+		   autoconf -o configure configure.ac+ && \
+		   $(RM) configure.ac+
+
 configure: configure.ac GIT-VERSION-FILE
-	$(QUIET_GEN)$(RM) $@ $<+ && \
-	sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-	    $< > $<+ && \
-	autoconf -o $@ $<+ && \
-	$(RM) $<+
+	$(QUIET_GEN)$(CONFIGURE_RECIPE)
 
 ifdef AUTOCONFIGURED
 # We avoid depending on 'configure' here, because it gets rebuilt
@@ -1885,7 +1887,7 @@ config.status: configure.ac
 # do want to recheck when the platform/environment detection logic
 # changes, hence this depends on configure.ac.
 config.status: configure.ac
-	$(QUIET_GEN)$(MAKE) configure && \
+	$(QUIET_GEN)$(CONFIGURE_RECIPE) && \
 	if test -f config.status; then \
 	  ./config.status --recheck; \
 	else \

-Peff

  reply	other threads:[~2013-02-21  6:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-20  8:44 [BUG] Infinite make recursion when configure.ac changes Stefano Lattarini
2013-02-21  6:04 ` Jeff King [this message]
2013-02-21  6:10   ` Junio C Hamano
2013-02-21  6:26     ` Jeff King
2013-02-21  7:59       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130221060401.GC25943@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=martinvonz@gmail.com \
    --cc=stefano.lattarini@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).