]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
test harness: avoid possible fork bomb
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 10 Aug 2011 13:37:27 +0000 (15:37 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 11 Aug 2011 09:58:05 +0000 (11:58 +0200)
This fixes a regression w.r.t. the master branch, exposed by
test 'parallel-tests-fork-bomb.test'.

* lib/am/check.am (am--redo-logs): Detect possible infinite
recursion due to a test log in $(TEST_LOGS) being the same
as $(TEST_SUITE_LOG).
* tests/parallel-tests-fork-bomb.test: Enhance and extend a
little now that we have more explicit semantics.

ChangeLog
lib/Automake/tests/Makefile.in
lib/am/check.am
tests/Makefile.in

index 76e1b3dd2062d59c10b105d3d58250478d3a46f2..4e50d370a65ff75b5c2069f2680472105490f88c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test harness: avoid possible fork bomb
+       This fixes a regression w.r.t. the master branch, exposed by
+       test 'parallel-tests-fork-bomb.test'.
+       * lib/am/check.am (am--redo-logs): Detect possible infinite
+       recursion due to a test log in $(TEST_LOGS) being the same
+       as $(TEST_SUITE_LOG).
+       * tests/parallel-tests-fork-bomb.test: Enhance and extend a
+       little now that we have more explicit semantics.
+
 2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        coverage: possible infinite recursion in the test harness
index c898f49cc8531b8b06680e8aef0e72a43f80a52e..aca691c99bd5a1883fc3bb56c1c53dac8f25f005 100644 (file)
@@ -352,7 +352,12 @@ cscope cscopelist:
 am--redo-logs:
        @rm -f $$redo_logs
        @rm -f $$redo_results
-       @$(MAKE) $(AM_MAKEFLAGS) $$redo_logs
+       @if test -n "$$am__remaking_logs"; then \
+         echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+              "recursion detected" >&2; \
+       else \
+         am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+       fi;
        @st=0;  \
        errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
        for i in $$redo_bases; do \
index 76c5273b84e5e299b29b7a820202fb53d3ac95d9..27388df02062fc79be23b533a7c89a6eb718accf 100644 (file)
@@ -132,7 +132,16 @@ am__set_TESTS_bases = \
 am--redo-logs:
        @rm -f $$redo_logs
        @rm -f $$redo_results
-       @$(MAKE) $(AM_MAKEFLAGS) $$redo_logs
+## The use of the `am__remaking_logs' environment variable below is
+## required to ensure that we don't go into an infinite recursion in
+## case a test log in $(TEST_LOGS) is the same as $(TEST_SUITE_LOG).
+## Yes, this has already happened in practice.  Sigh!
+       @if test -n "$$am__remaking_logs"; then \
+         echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+              "recursion detected" >&2; \
+       else \
+         am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+       fi;
 ## Sanity check: each unreadable or non-existent test result file should
 ## has been properly remade at this point, as should the corresponding log
 ## file.
index 1688557a6065ad496156587fbd9903f035115bd8..9e03806f4ed56a039f15620e970414acac07c956 100644 (file)
@@ -1508,7 +1508,12 @@ cscope cscopelist:
 am--redo-logs:
        @rm -f $$redo_logs
        @rm -f $$redo_results
-       @$(MAKE) $(AM_MAKEFLAGS) $$redo_logs
+       @if test -n "$$am__remaking_logs"; then \
+         echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+              "recursion detected" >&2; \
+       else \
+         am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+       fi;
        @st=0;  \
        errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
        for i in $$redo_bases; do \