# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../make/make-3.82-0001-MAKEFLAGS-re-exec.patch # Copyright (C) 2012 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- From 09a507e60034ce2ca38210a6eeaf1f9552edda68 Mon Sep 17 00:00:00 2001 From: Christian Wiese Date: Mon, 22 Oct 2012 17:39:10 +0200 Subject: [PATCH] MAKEFLAGS re-exec ChangeLog: 2010-08-10 Paul Smith * main.c (main): Expand MAKEFLAGS before adding it to the environment when re-exec'ing. Fixes Savannah bug #30723. tests/ChangeLog: 2010-08-10 Paul Smith * scripts/features/reinvoke: Ensure command line variable settings are preserved across make re-exec. Tests Savannah bug #30723. --- main.c | 2 +- tests/scripts/features/reinvoke | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index c6989e3..9fe8090 100644 --- a/main.c +++ b/main.c @@ -2093,7 +2093,7 @@ main (int argc, char **argv, char **envp) const char *pv = define_makeflags (1, 1); char *p = alloca (sizeof ("MAKEFLAGS=") + strlen (pv) + 1); sprintf (p, "MAKEFLAGS=%s", pv); - putenv (p); + putenv (allocated_variable_expand (p)); } if (ISDB (DB_BASIC)) diff --git a/tests/scripts/features/reinvoke b/tests/scripts/features/reinvoke index 9952ced..eb1a349 100644 --- a/tests/scripts/features/reinvoke +++ b/tests/scripts/features/reinvoke @@ -57,9 +57,24 @@ include $(F)', # Now try with the file we're not updating being the actual file we're # including: this and the previous one test different parts of the code. -run_make_test(undef, "F=b", "[ -f b ] || echo >> b\nhello\n") +run_make_test(undef, 'F=b', "[ -f b ] || echo >> b\nhello\n") &rmfiles('a','b','c'); +# Ensure command line variables are preserved properly across re-exec +# Tests for Savannah bug #30723 + +run_make_test(' +ifdef RECURSE +-include foo30723 +endif +recurse: ; @$(MAKE) -f $(MAKEFILE_LIST) RECURSE=1 test +test: ; @echo F.O=$(F.O) +foo30723: ; @touch $@ +', + '--no-print-directory F.O=bar', "F.O=bar\n"); + +unlink('foo30723'); + # This tells the test driver that the perl test script executed properly. 1; -- 1.7.2.3