From 24aac7f8f6c72d60ce7c9f80868cbf21fb458072 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 20 Mar 2006 02:36:36 +0000 Subject: [PATCH] Add some alloca(0) calls for systems without "normal" alloca support. Fix a file descriptor leak with make re-exec while using the jobserver. Update some release information. --- AUTHORS | 1 + ChangeLog | 15 +++++ NEWS | 2 +- README.cvs | 76 ++++++++++++++++++++--- job.c | 2 +- main.c | 98 +++++++++++++++++------------- remake.c | 4 ++ tests/ChangeLog | 6 ++ tests/scripts/features/parallelism | 29 +++++++++ 9 files changed, 179 insertions(+), 54 deletions(-) diff --git a/AUTHORS b/AUTHORS index e6a5f538..10c92587 100644 --- 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 + Additional development starting with GNU make 3.81 by: Boris Kolpackov diff --git a/ChangeLog b/ChangeLog index 026de24d..03416b90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2006-03-19 Paul D. Smith + + * 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 . + 2006-03-17 Paul D. Smith * maintMakefile (do-po-update): Rewrite this rule to clean up and diff --git a/NEWS b/NEWS index b720e020..1449e1b7 100644 --- 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. diff --git a/README.cvs b/README.cvs index 97e92596..634a3669 100644 --- a/README.cvs +++ b/README.cvs @@ -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: + + * 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 where RTAG is constructed by replacing each "." in + the version with "-" and prefixing it with "make-". -Windows builds from CVS ------------------------ +Publishing a Package +-------------------- -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. +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: -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. + Make sure the "Steps to Release" are complete and committed and tagged. + + cvs -d :pserver:anonymous@cvs.savannah.gnu.org:/source/make \ + export -r -d make-release make + + cd make-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 a81cd81c..793a61b7 100644 --- 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 53a2e2ea..483babfc 100644 --- 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]); + } +} /* 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 diff --git a/remake.c b/remake.c index 2dfade3c..a7527347 100644 --- 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; } @@ -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; diff --git a/tests/ChangeLog b/tests/ChangeLog index 67cf900e..e1241cfe 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2006-03-19 Paul D. Smith + + * 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 * scripts/features/statipattrules: Add tests for bug #16053. diff --git a/tests/scripts/features/parallelism b/tests/scripts/features/parallelism index 60ae55ba..528c6539 100644 --- a/tests/scripts/features/parallelism +++ b/tests/scripts/features/parallelism @@ -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;