LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File make-savannah-bug30723-expand_makeflags_before_reexec.diff of Package make (Project home:doiggl)

Index: ChangeLog
===================================================================
RCS file: /sources/make/make/ChangeLog,v
retrieving revision 2.418
retrieving revision 2.419
diff -u -p -u -p -r2.418 -r2.419
--- ChangeLog	7 Aug 2010 08:55:17 -0000	2.418
+++ ChangeLog	10 Aug 2010 07:35:34 -0000	2.419
@@ -1,3 +1,8 @@
+2010-08-10  Paul Smith  <psmith@gnu.org>
+
+	* main.c (main): Expand MAKEFLAGS before adding it to the
+	environment when re-exec'ing.  Fixes Savannah bug #30723.
+
 2010-07-28  Paul Smith  <psmith@gnu.org>
 
 	Version 3.82 released.
Index: main.c
===================================================================
RCS file: /sources/make/make/main.c,v
retrieving revision 1.243
retrieving revision 1.244
diff -u -p -u -p -r1.243 -r1.244
--- main.c	19 Jul 2010 07:10:53 -0000	1.243
+++ main.c	10 Aug 2010 07:35:34 -0000	1.244
@@ -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))
Index: tests/ChangeLog
===================================================================
RCS file: /sources/make/make/tests/ChangeLog,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -p -u -p -r1.149 -r1.150
--- tests/ChangeLog	28 Jul 2010 05:39:50 -0000	1.149
+++ tests/ChangeLog	10 Aug 2010 07:35:34 -0000	1.150
@@ -1,3 +1,8 @@
+2010-08-10  Paul Smith  <psmith@gnu.org>
+
+	* scripts/features/reinvoke: Ensure command line variable settings
+	are preserved across make re-exec.  Tests Savannah bug #30723.
+
 2010-07-28  Paul Smith  <psmith@gnu.org>
 
 	* scripts/targets/POSIX: Compatibility issues with Solaris (and
Index: tests/scripts/features/reinvoke
===================================================================
RCS file: /sources/make/make/tests/scripts/features/reinvoke,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -u -p -r1.7 -r1.8
--- tests/scripts/features/reinvoke	27 Jun 2005 22:18:47 -0000	1.7
+++ tests/scripts/features/reinvoke	10 Aug 2010 07:35:34 -0000	1.8
@@ -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;