Add some alloca(0) calls for systems without "normal" alloca support.
authorPaul Smith <psmith@gnu.org>
Mon, 20 Mar 2006 02:36:36 +0000 (02:36 +0000)
committerPaul Smith <psmith@gnu.org>
Mon, 20 Mar 2006 02:36:36 +0000 (02:36 +0000)
Fix a file descriptor leak with make re-exec while using the jobserver.
Update some release information.

AUTHORS
ChangeLog
NEWS
README.cvs
job.c
main.c
remake.c
tests/ChangeLog
tests/scripts/features/parallelism

diff --git a/AUTHORS b/AUTHORS
index e6a5f53..10c9258 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -6,6 +6,7 @@ GNU make development up to version 3.75 by:
 
 Development starting with GNU make 3.76 by:
     Paul D. Smith <psmith@gnu.org>
+
     Additional development starting with GNU make 3.81 by:
         Boris Kolpackov <boris@kolpackov.net>
 
index 026de24..03416b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2006-03-19  Paul D. Smith  <psmith@gnu.org>
+
+       * remake.c (update_file): Add alloca(0) to clean up alloca'd
+       memory on hosts that don't support it directly.
+
+       * README.cvs: Add information on steps for making a release (to
+       make sure I don't forget any).
+
+       * main.c (clean_jobserver): Move jobserver cleanup code into a new
+       function.
+       (die): Cleanup code was removed from here; call the new function.
+       (main): If we are re-execing, clean up the jobserver first so we
+       don't leak file descriptors.
+       Fix bug reported by Craig Fithian <craig.fithian@citigroup.com>.
+
 2006-03-17  Paul D. Smith  <psmith@gnu.org>
 
        * maintMakefile (do-po-update): Rewrite this rule to clean up and
diff --git a/NEWS b/NEWS
index b720e02..1449e1b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
 GNU make NEWS                                               -*-indented-text-*-
   History of user-visible changes.
-  8 March 2006
+  19 March 2006
 
 See the end of this file for copyrights and conditions.
 
index 97e9259..634a366 100644 (file)
@@ -82,6 +82,18 @@ That is, you can just run:
 to build and install GNU make.
 
 
+Windows builds from CVS
+-----------------------
+
+If you have a UNIX emulation like CYGWIN you can opt to run the general
+build procedure above; it will work.  Be sure to read
+README.W32.template for information on options you might want to use
+when running ./configure.
+
+If you can't or don't want to do that, then rename the file
+README.W32.template to README.W32 and follow those instructions.
+
+
 Creating a Package
 ------------------
 
@@ -107,19 +119,65 @@ converting to Automake is worth the trouble!  A big "huzzah!" to Tom
 T. and the AutoToolers!
 
 
-That's it, you're done!
+Steps to Release
+----------------
 
+Here are the things that need to be done (in more or less this order)
+before making an official release:
 
-Windows builds from CVS
------------------------
+  * Update the configure.in file with the new release number.
+  * Update the NEWS file with the release number and date.
+  * Update the doc/make.texi file with the release number and date.
+    Check the variables EDITION, VERSION, UPDATED, and UPDATE-MONTH.
+  * Create the new release in the Savannah "Bugs" Administration for
+    both the "Component Version" and "Fixed Release" fields.
+  * Create the new release in the Savannah "Patches" Administration for
+    the "Fixed Release" field.
+  * Update the Savannah bug list URL in the NEWS file to use the correct
+    "Fixed Release" ID number.
+  * Run "make distcheck" to be sure it all works.
+  * Commit everything.
+  * cvs tag -r<RTAG> where RTAG is constructed by replacing each "." in
+    the version with "-" and prefixing it with "make-".
 
-If you have a UNIX emulation like CYGWIN you can opt to run the general
-build procedure above; it will work.  Be sure to read
-README.W32.template for information on options you might want to use
-when running ./configure.
 
-If you can't or don't want to do that, then rename the file
-README.W32.template to README.W32 and follow those instructions.
+Publishing a Package
+--------------------
+
+In order to publish a package on the FSF FTP site, either the release
+site ftp://ftp.gnu.org, or the prerelease site ftp://alpha.gnu.org, you
+first need to have my GPG private key and my passphrase to unlock it.
+And, you can't have them!  So there!  But, just so I remember here's
+what you do:
+
+  Make sure the "Steps to Release" are complete and committed and tagged.
+
+  cvs -d :pserver:anonymous@cvs.savannah.gnu.org:/source/make \
+     export -r<RTAG> -d make-release make
+
+  cd make-release
+
+  <run the commands above to build the release>
+
+  make upload-alpha             # for alpha.gnu.org (pre-releases)
+       -OR-
+  make upload-ftp               # for ftp.gnu.org (official releases)
+
+It will ask for the GPG passphrase _THREE_ times.  Sigh.
+
+
+Where to Announce
+-----------------
+
+Create the announcement in a text file, then sign it with GPG.  Upload
+to gnu.org, then login and send from my account there.
+
+Email to: make-alpha@gnu.org, bug-make@gnu.org, help-make@gnu.org, make-w32@gnu.org.
+Email to: info-gnu@gnu.org
+
+Add a news item to the Savannah project site.
+
+Add an update to freshmeat.net.
 
 
 Appendix A - For The Brave
diff --git a/job.c b/job.c
index a81cd81..793a61b 100644 (file)
--- a/job.c
+++ b/job.c
@@ -716,7 +716,7 @@ reap_children (int block, int err)
       if (c->good_stdin)
         good_stdin_used = 0;
 
-      dontcare = c->dontcare;
+      dontcare = c->file->dontcare;
 
       if (child_failed && !c->noerror && !ignore_errors_flag)
         {
diff --git a/main.c b/main.c
index 53a2e2e..483babf 100644 (file)
--- a/main.c
+++ b/main.c
@@ -81,6 +81,7 @@ extern void exit PARAMS ((int)) __attribute__ ((noreturn));
 extern double atof ();
 #endif
 
+static void clean_jobserver PARAMS ((int status));
 static void print_data_base PARAMS ((void));
 static void print_version PARAMS ((void));
 static void decode_switches PARAMS ((int argc, char **argv, int env));
@@ -1969,6 +1970,8 @@ main (int argc, char **argv, char **envp)
 
          log_working_directory (0);
 
+          clean_jobserver (0);
+
          if (makefiles != 0)
            {
              /* These names might have changed.  */
@@ -2957,7 +2960,7 @@ print_version (void)
 /* Print a bunch of information about this and that.  */
 
 static void
-print_data_base (void)
+print_data_base ()
 {
   time_t when;
 
@@ -2974,6 +2977,56 @@ print_data_base (void)
   when = time ((time_t *) 0);
   printf (_("\n# Finished Make data base on %s\n"), ctime (&when));
 }
+
+static void
+clean_jobserver (int status)
+{
+  char token = '+';
+
+  /* Sanity: have we written all our jobserver tokens back?  If our
+     exit status is 2 that means some kind of syntax error; we might not
+     have written all our tokens so do that now.  If tokens are left
+     after any other error code, that's bad.  */
+
+  if (job_fds[0] != -1 && jobserver_tokens)
+    {
+      if (status != 2)
+        error (NILF,
+               "INTERNAL: Exiting with %u jobserver tokens (should be 0)!",
+               jobserver_tokens);
+      else
+        while (jobserver_tokens--)
+          {
+            int r;
+
+            EINTRLOOP (r, write (job_fds[1], &token, 1));
+            if (r != 1)
+              perror_with_name ("write", "");
+          }
+    }
+
+
+  /* Sanity: If we're the master, were all the tokens written back?  */
+
+  if (master_job_slots)
+    {
+      /* We didn't write one for ourself, so start at 1.  */
+      unsigned int tcnt = 1;
+
+      /* Close the write side, so the read() won't hang.  */
+      close (job_fds[1]);
+
+      while (read (job_fds[0], &token, 1) == 1)
+        ++tcnt;
+
+      if (tcnt != master_job_slots)
+        error (NILF,
+               "INTERNAL: Exiting with %u jobserver tokens available; should be %u!",
+               tcnt, master_job_slots);
+
+      close (job_fds[0]);
+    }
+}
 \f
 /* Exit with STATUS, cleaning up as necessary.  */
 
@@ -2984,7 +3037,6 @@ die (int status)
 
   if (!dying)
     {
-      char token = '+';
       int err;
 
       dying = 1;
@@ -3006,47 +3058,7 @@ die (int status)
       if (print_data_base_flag)
        print_data_base ();
 
-      /* Sanity: have we written all our jobserver tokens back?  If our
-         exit status is 2 that means some kind of syntax error; we might not
-         have written all our tokens so do that now.  If tokens are left
-         after any other error code, that's bad.  */
-
-      if (job_fds[0] != -1 && jobserver_tokens)
-        {
-          if (status != 2)
-            error (NILF,
-                   "INTERNAL: Exiting with %u jobserver tokens (should be 0)!",
-                   jobserver_tokens);
-          else
-            while (jobserver_tokens--)
-              {
-                int r;
-
-                EINTRLOOP (r, write (job_fds[1], &token, 1));
-                if (r != 1)
-                  perror_with_name ("write", "");
-              }
-        }
-
-
-      /* Sanity: If we're the master, were all the tokens written back?  */
-
-      if (master_job_slots)
-        {
-          /* We didn't write one for ourself, so start at 1.  */
-          unsigned int tcnt = 1;
-
-          /* Close the write side, so the read() won't hang.  */
-          close (job_fds[1]);
-
-          while ((err = read (job_fds[0], &token, 1)) == 1)
-            ++tcnt;
-
-          if (tcnt != master_job_slots)
-            error (NILF,
-                   "INTERNAL: Exiting with %u jobserver tokens available; should be %u!",
-                   tcnt, master_job_slots);
-        }
+      clean_jobserver (status);
 
       /* Try to move back to the original directory.  This is essential on
         MS-DOS (where there is really only one process), and on Unix it
index 2dfade3..a752734 100644 (file)
--- a/remake.c
+++ b/remake.c
@@ -264,6 +264,7 @@ update_goal_chain (struct dep *goals)
       just_print_flag = n;
       job_slots = j;
     }
+
   return status;
 }
 \f
@@ -306,6 +307,9 @@ update_file (struct file *file, unsigned int depth)
       status |= update_file_1 (f, depth);
       check_renamed (f);
 
+      /* Clean up any alloca() used during the update.  */
+      alloca (0);
+
       /* If we got an error, don't bother with double_colon etc.  */
       if (status != 0 && !keep_going_flag)
        return status;
index 67cf900..e1241cf 100644 (file)
@@ -1,3 +1,9 @@
+2006-03-19  Paul D. Smith  <psmith@gnu.org>
+
+       * scripts/features/parallelism: Test that the jobserver is
+       properly managed when we have to re-exec the master instance of
+       make.
+
 2006-03-17  Boris Kolpackov  <boris@kolpackov.net>
 
        * scripts/features/statipattrules: Add tests for bug #16053.
index 60ae55b..528c653 100644 (file)
@@ -126,4 +126,33 @@ mod_a.o mod_b.o:
 ', '-j2', '');
 
 
+# Make sure that all jobserver FDs are closed if we need to re-exec the
+# master copy.
+
+run_make_test('
+submake: ; @$(MAKE) --no-print-directory -f #MAKEFILE# fdprint 5>output
+
+dependfile: ; @echo FOO=bar > $@
+
+INCL := true
+
+FOO=foo
+ifeq ($(INCL),true)
+-include dependfile
+endif
+
+fdprint: ; @echo hi >&5 && echo "$(FOO)"
+
+recurse: ; @$(MAKE) --no-print-directory -f #MAKEFILE# submake INCL=true',
+              '-j2',
+              'bar');
+
+unlink('dependfile');
+
+
+# Do it again, this time where the include is done by the non-master make.
+run_make_test(undef, '-j2 recurse INCL=false', 'bar');
+
+unlink('dependfile');
+
 1;