Blame SOURCES/make-3.82-bugfixes.patch

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