[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [FYI 2/2] built sources: avoid fork bomb in $(BUILT_SOURCE
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [FYI 2/2] built sources: avoid fork bomb in $(BUILT_SOURCES) handling |
Date: |
Tue, 11 Sep 2012 16:49:52 +0200 |
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:
<http://lists.gnu.org/archive/html/help-smalltalk/2012-08/msg00027.html>
<http://lists.gnu.org/archive/html/automake-patches/2012-08/msg00052.html>
* 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 <address@hidden>
---
Makefile.am | 1 -
lib/am/common-targets.mk | 8 ++++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index e19f3fd..656ebac 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 b9eb64f..da8e16c 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
--
1.7.12