Blame SOURCES/make-3.82-bugfixes.patch

5589dc
diff -urpN make/ChangeLog make-new/ChangeLog
5589dc
--- make/ChangeLog	2010-09-13 13:42:35.000000000 +0200
5589dc
+++ make-new/ChangeLog	2010-09-13 13:42:09.000000000 +0200
5589dc
@@ -1,3 +1,22 @@
5589dc
+2010-08-13  Paul Smith  <psmith@gnu.org>
5589dc
+
5589dc
+	* NEWS: Accidentally forgot to back out the sorted wildcard
5589dc
+	enhancement in 3.82, so update NEWS.
5589dc
+	Also add NEWS about the error check for explicit and pattern
5589dc
+	targets in the same rule, added to 3.82.
5589dc
+
5589dc
+	* main.c (main): Add "oneshell" to $(.FEATURES) (forgot to add
5589dc
+	this in 3.82!)
5589dc
+
5589dc
+	* read.c (parse_file_seq): Fix various errors parsing archives
5589dc
+	with multiple objects in the parenthesis, as well as wildcards.
5589dc
+	Fixes Savannah bug #30612.
5589dc
+
5589dc
+2010-08-10  Paul Smith  <psmith@gnu.org>
5589dc
+
5589dc
+	* main.c (main): Expand MAKEFLAGS before adding it to the
5589dc
+	environment when re-exec'ing.  Fixes Savannah bug #30723.
5589dc
+
5589dc
 2010-07-28  Paul Smith  <psmith@gnu.org>
5589dc
 
5589dc
 	Version 3.82 released.
5589dc
diff -urpN make/main.c make-new/main.c
5589dc
--- make/main.c	2010-09-13 13:42:35.000000000 +0200
5589dc
+++ make-new/main.c	2010-09-13 13:42:12.000000000 +0200
5589dc
@@ -1138,7 +1138,7 @@ main (int argc, char **argv, char **envp
5589dc
      a macro and some compilers (MSVC) don't like conditionals in macros.  */
5589dc
   {
5589dc
     const char *features = "target-specific order-only second-expansion"
5589dc
-                           " else-if shortest-stem undefine"
5589dc
+                           " else-if shortest-stem undefine oneshell"
5589dc
 #ifndef NO_ARCHIVES
5589dc
                            " archives"
5589dc
 #endif
5589dc
@@ -2093,7 +2093,7 @@ main (int argc, char **argv, char **envp
5589dc
             const char *pv = define_makeflags (1, 1);
5589dc
             char *p = alloca (sizeof ("MAKEFLAGS=") + strlen (pv) + 1);
5589dc
             sprintf (p, "MAKEFLAGS=%s", pv);
5589dc
-            putenv (p);
5589dc
+            putenv (allocated_variable_expand (p));
5589dc
           }
5589dc
 
5589dc
 	  if (ISDB (DB_BASIC))
5589dc
diff -urpN make/NEWS make-new/NEWS
5589dc
--- make/NEWS	2010-09-13 13:42:35.000000000 +0200
5589dc
+++ make-new/NEWS	2010-09-13 13:42:11.000000000 +0200
5589dc
@@ -18,14 +18,6 @@ http://sv.gnu.org/bugs/index.php?group=m
5589dc
 * Compiling GNU make now requires a conforming ISO C 1989 compiler and
5589dc
   standard runtime library.
5589dc
 
5589dc
-* WARNING: Future backward-incompatibility!
5589dc
-  Wildcards are not documented as returning sorted values, but up to and
5589dc
-  including this release the results have been sorted and some makefiles are
5589dc
-  apparently depending on that.  In the next release of GNU make, for
5589dc
-  performance reasons, we may remove that sorting.  If your makefiles
5589dc
-  require sorted results from wildcard expansions, use the $(sort ...)
5589dc
-  function to request it explicitly.
5589dc
-
5589dc
 * WARNING: Backward-incompatibility!
5589dc
   The POSIX standard for make was changed in the 2008 version in a
5589dc
   fundamentally incompatible way: make is required to invoke the shell as if
5589dc
@@ -42,6 +34,21 @@ http://sv.gnu.org/bugs/index.php?group=m
5589dc
   existing targets were provided in $?).
5589dc
 
5589dc
 * WARNING: Backward-incompatibility!
5589dc
+  Wildcards were not documented as returning sorted values, but the results
5589dc
+  have been sorted up until this release..  If your makefiles require sorted
5589dc
+  results from wildcard expansions, use the $(sort ...)  function to request
5589dc
+  it explicitly.
5589dc
+
5589dc
+* WARNING: Backward-incompatibility!
5589dc
+  In previous versions of make it was acceptable to list one or more explicit
5589dc
+  targets followed by one or more pattern targets in the same rule and it
5589dc
+  worked "as expected".  However, this was not documented as acceptable and if
5589dc
+  you listed any explicit targets AFTER the pattern targets, the entire rule
5589dc
+  would be mis-parsed.  This release removes this ability completely: make
5589dc
+  will generate an error message if you mix explicit and pattern targets in
5589dc
+  the same rule.
5589dc
+
5589dc
+* WARNING: Backward-incompatibility!
5589dc
   As a result of parser enhancements, three backward-compatibility issues
5589dc
   exist: first, a prerequisite containing an "=" cannot be escaped with a
5589dc
   backslash any longer.  You must create a variable containing an "=" and
5589dc
diff -urpN make/read.c make-new/read.c
5589dc
--- make/read.c	2010-09-13 13:42:35.000000000 +0200
5589dc
+++ make-new/read.c	2010-09-13 13:42:11.000000000 +0200
5589dc
@@ -3028,7 +3028,7 @@ parse_file_seq (char **stringp, unsigned
5589dc
             {
5589dc
               /* This looks like the first element in an open archive group.
5589dc
                  A valid group MUST have ')' as the last character.  */
5589dc
-              const char *e = p + nlen;
5589dc
+              const char *e = p;
5589dc
               do
5589dc
                 {
5589dc
                   e = next_token (e);
5589dc
@@ -3084,19 +3084,19 @@ parse_file_seq (char **stringp, unsigned
5589dc
          Go to the next item in the string.  */
5589dc
       if (flags & PARSEFS_NOGLOB)
5589dc
         {
5589dc
-          NEWELT (concat (2, prefix, tp));
5589dc
+          NEWELT (concat (2, prefix, tmpbuf));
5589dc
           continue;
5589dc
         }
5589dc
 
5589dc
       /* If we get here we know we're doing glob expansion.
5589dc
          TP is a string in tmpbuf.  NLEN is no longer used.
5589dc
          We may need to do more work: after this NAME will be set.  */
5589dc
-      name = tp;
5589dc
+      name = tmpbuf;
5589dc
 
5589dc
       /* Expand tilde if applicable.  */
5589dc
-      if (tp[0] == '~')
5589dc
+      if (tmpbuf[0] == '~')
5589dc
 	{
5589dc
-	  tildep = tilde_expand (tp);
5589dc
+	  tildep = tilde_expand (tmpbuf);
5589dc
 	  if (tildep != 0)
5589dc
             name = tildep;
5589dc
 	}
5589dc
@@ -3152,7 +3152,10 @@ parse_file_seq (char **stringp, unsigned
5589dc
             else
5589dc
               {
5589dc
                 /* We got a chain of items.  Attach them.  */
5589dc
-                (*newp)->next = found;
5589dc
+                if (*newp)
5589dc
+                  (*newp)->next = found;
5589dc
+                else
5589dc
+                  *newp = found;
5589dc
 
5589dc
                 /* Find and set the new end.  Massage names if necessary.  */
5589dc
                 while (1)
5589dc
diff -urpN make/tests/ChangeLog make-new/tests/ChangeLog
5589dc
--- make/tests/ChangeLog	2010-09-13 13:42:35.000000000 +0200
5589dc
+++ make-new/tests/ChangeLog	2010-09-13 13:42:10.000000000 +0200
5589dc
@@ -1,3 +1,16 @@
5589dc
+2010-08-13  Paul Smith  <psmith@gnu.org>
5589dc
+
5589dc
+	* scripts/features/archives: New regression tests for archive
5589dc
+	support.  Test for fix to Savannah bug #30612.
5589dc
+
5589dc
+	* run_make_tests.pl (set_more_defaults): Set a %FEATURES hash to
5589dc
+	the features available in $(.FEATURES).
5589dc
+
5589dc
+2010-08-10  Paul Smith  <psmith@gnu.org>
5589dc
+
5589dc
+	* scripts/features/reinvoke: Ensure command line variable settings
5589dc
+	are preserved across make re-exec.  Tests Savannah bug #30723.
5589dc
+
5589dc
 2010-07-28  Paul Smith  <psmith@gnu.org>
5589dc
 
5589dc
 	* scripts/targets/POSIX: Compatibility issues with Solaris (and
5589dc
diff -urpN make/tests/run_make_tests.pl make-new/tests/run_make_tests.pl
5589dc
--- make/tests/run_make_tests.pl	2010-09-13 13:42:35.000000000 +0200
5589dc
+++ make-new/tests/run_make_tests.pl	2010-09-13 13:42:10.000000000 +0200
5589dc
@@ -29,6 +29,7 @@
5589dc
 # You should have received a copy of the GNU General Public License along with
5589dc
 # this program.  If not, see <http://www.gnu.org/licenses/>.
5589dc
 
5589dc
+%FEATURES = ();
5589dc
 
5589dc
 $valgrind = 0;              # invoke make with valgrind
5589dc
 $valgrind_args = '';
5589dc
@@ -367,6 +368,8 @@ sub set_more_defaults
5589dc
      $parallel_jobs = 1;
5589dc
    }
5589dc
 
5589dc
+   %FEATURES = map { $_ => 1 } split /\s+/, `sh -c "echo '\\\$(info \\\$(.FEATURES))' | $make_path -f- 2>/dev/null"`;
5589dc
+
5589dc
    # Set up for valgrind, if requested.
5589dc
 
5589dc
    if ($valgrind) {
5589dc
diff -urpN make/tests/scripts/features/archives make-new/tests/scripts/features/archives
5589dc
--- make/tests/scripts/features/archives	1970-01-01 01:00:00.000000000 +0100
5589dc
+++ make-new/tests/scripts/features/archives	2010-09-13 13:42:10.000000000 +0200
5589dc
@@ -0,0 +1,42 @@
5589dc
+#                                                              -*-mode: perl-*-
5589dc
+
5589dc
+$description = "Test GNU make's archive management features.";
5589dc
+
5589dc
+$details = "\
5589dc
+This only works on systems that support it.";
5589dc
+
5589dc
+# If this instance of make doesn't support archives, skip it
5589dc
+exists $FEATURES{archives} or return -1;
5589dc
+
5589dc
+# Create some .o files to work with
5589dc
+utouch(-60, qw(a1.o a2.o a3.o));
5589dc
+
5589dc
+# Very simple
5589dc
+run_make_test('all: libxx.a(a1.o)',
5589dc
+              '', "ar rv libxx.a a1.o\nar: creating libxx.a\na - a1.o\n");
5589dc
+
5589dc
+# Multiple .o's.  Add a new one to the existing library
5589dc
+run_make_test('all: libxx.a(a1.o a2.o)',
5589dc
+              '', "ar rv libxx.a a2.o\na - a2.o\n");
5589dc
+
5589dc
+# Touch one of the .o's so it's rebuilt
5589dc
+utouch(-40, 'a1.o');
5589dc
+run_make_test(undef, '', "ar rv libxx.a a1.o\nr - a1.o\n");
5589dc
+
5589dc
+# Use wildcards
5589dc
+run_make_test('all: libxx.a(*.o)',
5589dc
+              '', "#MAKE#: Nothing to be done for `all'.\n");
5589dc
+
5589dc
+# Touch one of the .o's so it's rebuilt
5589dc
+utouch(-30, 'a1.o');
5589dc
+run_make_test(undef, '', "ar rv libxx.a a1.o\nr - a1.o\n");
5589dc
+
5589dc
+# Use both wildcards and simple names
5589dc
+utouch(-50, 'a2.o');
5589dc
+run_make_test('all: libxx.a(a3.o *.o)', '',
5589dc
+              "ar rv libxx.a a3.o\na - a3.o\nar rv libxx.a a2.o\nr - a2.o\n");
5589dc
+
5589dc
+rmfiles(qw(a1.o a2.o a3.o libxx.a));
5589dc
+
5589dc
+# This tells the test driver that the perl test script executed properly.
5589dc
+1;
5589dc
diff -urpN make/tests/scripts/features/reinvoke make-new/tests/scripts/features/reinvoke
5589dc
--- make/tests/scripts/features/reinvoke	2010-09-13 13:42:35.000000000 +0200
5589dc
+++ make-new/tests/scripts/features/reinvoke	2010-09-13 13:42:10.000000000 +0200
5589dc
@@ -57,9 +57,24 @@ include $(F)',
5589dc
 # Now try with the file we're not updating being the actual file we're
5589dc
 # including: this and the previous one test different parts of the code.
5589dc
 
5589dc
-run_make_test(undef, "F=b", "[ -f b ] || echo >> b\nhello\n")
5589dc
+run_make_test(undef, 'F=b', "[ -f b ] || echo >> b\nhello\n")
5589dc
 
5589dc
 &rmfiles('a','b','c');
5589dc
 
5589dc
+# Ensure command line variables are preserved properly across re-exec
5589dc
+# Tests for Savannah bug #30723
5589dc
+
5589dc
+run_make_test('
5589dc
+ifdef RECURSE
5589dc
+-include foo30723
5589dc
+endif
5589dc
+recurse: ; @$(MAKE) -f $(MAKEFILE_LIST) RECURSE=1 test
5589dc
+test: ; @echo F.O=$(F.O)
5589dc
+foo30723: ; @touch $@
5589dc
+',
5589dc
+              '--no-print-directory F.O=bar', "F.O=bar\n");
5589dc
+
5589dc
+unlink('foo30723');
5589dc
+
5589dc
 # This tells the test driver that the perl test script executed properly.
5589dc
 1;