From: Stefano Lattarini Date: Mon, 10 Sep 2012 15:36:38 +0000 (+0200) Subject: built sources: avoid fork bomb in $(BUILT_SOURCES) handling X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6154da4d88442ffcbd3423a71d632b5a4a547878;p=thirdparty%2Fautomake.git built sources: avoid fork bomb in $(BUILT_SOURCES) handling Due to how the handling of $(BUILT_SOURCES) was implemented in Automake-NG, a recursive make call in the recipe of any $(BUILT_SOURCES) (or of any of its prerequisites) would have caused an infinite recursion (complete with fork bomb, yuck). Work around the issue. See: * lib/am/common-targets.mk: Here, with the help of ... (am.hack.making-built-sources): ... this new internal variable. * Makefile.am (XFAIL_TESTS): Remove 't/built-sources-fork-bomb.sh'. Signed-off-by: Stefano Lattarini --- diff --git a/Makefile.am b/Makefile.am index e19f3fdf8..656ebac78 100644 --- a/Makefile.am +++ b/Makefile.am @@ -338,7 +338,6 @@ perl_fake_XFAIL_TESTS = \ XFAIL_TESTS = \ t/all.sh \ - t/built-sources-fork-bomb.sh \ t/override-suggest-local.sh \ t/comments-in-var-def.sh \ t/cond17.sh \ diff --git a/lib/am/common-targets.mk b/lib/am/common-targets.mk index b9eb64f3b..da8e16c8f 100644 --- a/lib/am/common-targets.mk +++ b/lib/am/common-targets.mk @@ -159,8 +159,16 @@ ifeq ($(am.make.dry-run),true) # completely accurate. all check install: | $(am.built-early) else +# Also, with this implementation, a recursive make call in the recipe +# of any $(BUILT_SOURCES) (or any of its prerequisites) could cause an +# infinite recursion (complete with fork bomb, yuck), if we are not +# careful. The following hack takes care of the problem. +$(am.built-early): am.hack.making-built-sources = yes +export am.hack.making-built-sources +ifndef am.hack.making-built-sources $(foreach x,$(am.built-early),$(eval -include .am/built-sources/$(x))) .am/built-sources/%: | % @$(am.cmd.ensure-target-dir-exists) @touch $@ endif +endif