From 7cf149fc7985459386e47d95a18bc39a69346b18 Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Thu, 22 Aug 2013 18:17:20 +0200 Subject: [PATCH] Restore stack limit in processes spawned through $(shell) - That caused intermittent failures in targets/SECONDARY. Turns out those are caused by the test suite being non-deterministic. Add a patch for that as well. --- make-3.82-func_shell-rlimit.patch | 35 +++++++++++++++++++++++++++++++ make-3.82-tests-SECONDARY.patch | 30 ++++++++++++++++++++++++++ make.spec | 18 +++++++++++++++- 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 make-3.82-func_shell-rlimit.patch create mode 100644 make-3.82-tests-SECONDARY.patch diff --git a/make-3.82-func_shell-rlimit.patch b/make-3.82-func_shell-rlimit.patch new file mode 100644 index 0000000..28183a9 --- /dev/null +++ b/make-3.82-func_shell-rlimit.patch @@ -0,0 +1,35 @@ +From 552207b506f4d98a6a5f73053aa6bd924758708f Mon Sep 17 00:00:00 2001 +From: Petr Machata +Date: Thu, 22 Aug 2013 16:46:17 +0200 +Subject: [PATCH] Get rid of stack size limit for processes spawned via + $(shell) + +--- + ChangeLog | 5 +++++ + function.c | 10 +++++++++- + 2 files changed, 14 insertions(+), 1 deletions(-) + +diff --git a/function.c b/function.c +index 9eabd73..e121b9a 100644 +--- a/function.c ++++ b/function.c +@@ -1715,7 +1715,15 @@ func_shell_base (char *o, char **argv, int trim_newlines) + if (pid < 0) + perror_with_name (error_prefix, "fork"); + else if (pid == 0) +- child_execute_job (0, pipedes[1], command_argv, envp); ++ { ++#ifdef SET_STACK_SIZE ++ /* Reset limits, if necessary. */ ++ if (stack_limit.rlim_cur) ++ setrlimit (RLIMIT_STACK, &stack_limit); ++#endif ++ ++ child_execute_job (0, pipedes[1], command_argv, envp); ++ } + else + # endif + #endif +-- +1.7.6.5 + diff --git a/make-3.82-tests-SECONDARY.patch b/make-3.82-tests-SECONDARY.patch new file mode 100644 index 0000000..989f12b --- /dev/null +++ b/make-3.82-tests-SECONDARY.patch @@ -0,0 +1,30 @@ +From 3057357c0a5c2507eef2b61eef9ebfb569b30230 Mon Sep 17 00:00:00 2001 +From: Paul Smith +Date: Sat, 10 Dec 2011 17:13:14 +0000 +Subject: [PATCH] Add prerequisites to ensure ordering of results. + +--- + tests/scripts/targets/SECONDARY | 5 +++-- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/tests/scripts/targets/SECONDARY b/tests/scripts/targets/SECONDARY +index c954ee9..26515d8 100644 +--- a/tests/scripts/targets/SECONDARY ++++ b/tests/scripts/targets/SECONDARY +@@ -129,10 +129,11 @@ touch(qw(1.a 2.a)); + run_make_test(' + %.c : %.b ; cp $< $@ + %.b : %.a ; cp $< $@ +-all : 1.c 2.c', '-rR -j', ++all : 1.c 2.c ++2.a: 1.c', '-rR -j', + 'cp 1.a 1.b +-cp 2.a 2.b + cp 1.b 1.c ++cp 2.a 2.b + cp 2.b 2.c + rm 1.b 2.b'); + +-- +1.7.6.5 + diff --git a/make.spec b/make.spec index efa883c..3915f95 100644 --- a/make.spec +++ b/make.spec @@ -3,7 +3,7 @@ Summary: A GNU tool which simplifies the build process for users Name: make Epoch: 1 Version: 3.82 -Release: 18%{?dist} +Release: 19%{?dist} License: GPLv2+ Group: Development/Tools URL: http://www.gnu.org/software/make/ @@ -53,6 +53,14 @@ Patch18: make-3.82-empty-members.patch # https://bugzilla.redhat.com/show_bug.cgi?id=987672 Patch19: make-3.82-stem_glob.patch +# Stack limit not restored for processes spawned through $(shell) +# https://savannah.gnu.org/bugs/index.php?39851 +Patch20: make-3.82-func_shell-rlimit.patch + +# This to make the test targets/SECONDARY deterministic. The above +# patch causes this to occasionally fail. +Patch21: make-3.82-tests-SECONDARY.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires(post): /sbin/install-info Requires(preun): /sbin/install-info @@ -86,6 +94,9 @@ makefile. %patch17 -p1 %patch18 -p1 %patch19 -p1 +%patch20 -p1 +%patch21 -p1 + rm -f tests/scripts/features/parallelism.orig %build @@ -129,6 +140,11 @@ fi %{_infodir}/*.info* %changelog +* Thu Aug 22 2013 Petr Machata - 1:3.82-19 +- make now restores rlimit to its original values before launching + subprocess via $(shell) (make-3.82-func_shell-rlimit.patch) +- Determinize one test (make-3.82-tests-SECONDARY.patch) + * Fri Jul 26 2013 Petr Machata - 1:3.82-18 - Backport upstream patch that adds wildcard expansion to pattern rules. (make-3.82-stem_glob.patch)