Commit graph

2529 commits

Author SHA1 Message Date
Paul Smith
14b2d7effb * job.c (exec_command): [SV 47365] Show error on exec failure. 2016-03-09 00:18:57 -05:00
Paul Smith
85c788572d [SV 46261] Use pselect() for jobserver where supported.
* Makefile.am, configure.ac: Check for pselect() and sys/select.h.
* main.c (main): Block SIGCHLD if we have pselect() support.
* posixos.c (jobserver_acquire): If we support pselect() then use
it to query the jobserver pipe, while also listening for SIGCHLD.
Also pselect() supports a timeout so avoid alarm() calls.
2016-03-08 23:40:46 -05:00
Paul Smith
8164c8ab3d Clean up some compiler warnings.
* commands.c, commands.h: Use unsigned char for flags.
* dir.c: Use time_t and size_t, and char for a boolean value.
* job.c: Use unsigned and char.
* read.c: Return a signed type since -1 is a valid return code.
2016-03-08 23:40:46 -05:00
Paul Smith
fb7a7adc8a Extract jobserver implementation into OS-specific files.
* os.h, posixos.c, w32/w32os.c: New files implementing jobserver.
* job.c, job.h, main.c, makeint.h: Move content to new files.
* w32/include/sub_proc.h, w32/subproc/sub_proc.c: Ditto.
* Makefile.am: Build and package OS-specific files.
* build_w32.bat, make_msvc_net2003.vcproj, README.W32.template:
Update for new files, and clean up the build.
* POTFILES.in, maintMakefile, NMakefile.template: Ditto.
* w32/subproc/build.bat: Delete as unused.
2016-03-08 23:40:46 -05:00
Paul Smith
4f8be4bb28 [SV 46261] Add more EINTRLOOP wrappers.
This cannot be a perfect solution because there are always other
possible places EINTR can happen, including external libraries
such as gettext, Guile etc.
2016-03-08 00:31:47 -05:00
Paul Smith
e2b39edc22 * strcache.c (add_hugestring): [SV 46832] Support huge strings.
The strcache was limited to strings of length 65535 or less,
because the length is kept in an unsigned short.  To support
huge strings add a new simple linked list, which we don't try
to hash.
2016-02-29 01:35:02 -05:00
Paul Smith
8530d77c68 * strcache.c (add_string): [SV 47071] Handle huge initial string.
If the very first string added to the string cache is more than
half the maximum size, we failed when moving the only strcache
buffer to the full list.
2016-02-29 01:35:02 -05:00
Paul Smith
89e18c12eb [SV 47151] Exit with 1 when checking recursive make -q
* job.h (struct child): New bit to mark recursive command lines.
* job.c (start_job_command): Set the recursive command line bit.
(reap_children): If the child is a recursive command and it exits
with 1 during question mode, don't print an error and exit with 1.
* tests/scripts/options/dash-q: Add a regression test.
2016-02-29 01:33:50 -05:00
Paul Smith
bccd01354b * main.c (define_makeflags): Add parens to avoid GCC warning. 2016-02-29 01:32:12 -05:00
Paul Smith
5f9d341160 * tests/scripts/features/archives: Handle deterministic archives.
Newer versions of binutils allow ar to be compiled to generate
"deterministic archives" by default: in this mode no timestamp
information is generated in the static archive, which utterly
breaks GNU make's archive updating capability.  Debian and Ubuntu
have turned this feature on by default in their distributions
which causes the regression tests to fail.

Update the regression tests to check for the availability of the
"U" option to ar which disables deterministic archives and allows
GNU make's archive support to work properly again.
2016-02-29 01:31:16 -05:00
Paul Smith
798ebd241b Update Copyright statements for the new year. 2016-02-28 12:55:20 -05:00
Paul Smith
4db6d0c694 * doc/make.texi: [SV 47163] Fix typo in 'ifdef' documentation. 2016-02-28 12:41:41 -05:00
Paul Smith
b754a35df7 * doc/make.texi: [SV 35455] Add more uses for Empty Recipes. 2016-02-28 12:35:15 -05:00
Gisle Vanem
168f12375d Fix diagnostics on MS-Windows when environment is too large
* w32/subproc/sub_proc.c (process_begin): Fix test of the error
	cause when the environment block is too large.

Copyright-paperwork-exempt: yes.
2015-11-07 11:27:03 +02:00
Eli Zaretskii
83443c706a Update README.W32.template
* README.W32.template: Update for latest developments.  Make it
clear we don't recommend using HAVE_CASE_INSENSITIVE_FS in
general.
2015-10-27 20:51:43 +02:00
Eli Zaretskii
4a5377aef7 [SV 46304] Don't invoke C++ compiler on C sources on MS-Windows
* default.c (default_variables) [HAVE_CASE_INSENSITIVE_FS]: Make
COMPILE.C and LINK.C be synonyms for COMPILE.c and LINK.c,
respectively.
2015-10-27 20:47:27 +02:00
Eli Zaretskii
48391c2817 [SV 45838] When invoking w32 programs, don't use free'd memory.
* w32/subproc/sub_proc.c (process_begin): Freeing argv[0] makes
the other argv[i] pointers invalid, so need to allocate a new
array and copy argv[i] for i != 0 first, replacing argv[0] with
the batch file name, before we can free argv[0].
2015-09-23 11:42:53 +03:00
Paul Smith
42745a900f * implicit.c (pattern_search): [SV 43677] Mark files secondary.
In order to fix SV 12267 we were marking the prerequisites of
implicit (pattern) targets that existed elsewhere in the makefile
as precious to keep them from being deleted as intermediate files.
However this also keeps them from being deleted on error.  Instead
mark them as secondary.
* tests/scripts/targets/DELETE_ON_ERROR: Test DELETE_ON_ERROR.
2015-07-13 00:51:35 -04:00
Paul Smith
43181f1f82 [SV 28092] Preserve the exit status of the $(shell...) function.
Add a new variable .SHELLSTATUS which holds the exit status of the
last-invoked shell function or != assignment.

* NEWS, doc/make.texi: Document the change.
* function.c (shell_completed, msdos_openpipe, func_shell_base): Add
shell_completed() to handle the completion of the shell, by setting
.SHELLSTATUS.  Call it where needed.
* job.c (child_handler): Call shell_completed().
* tests/scripts/functions/shell: Add tests for .SHELLSTATUS.
2015-07-12 21:03:24 -04:00
Paul Smith
c18b23f7b2 * tests/scripts/misc/fopen-fail: [SV 42390] Increase test timeout.
* Makefile.am (check-regression): Force ulimit -n for fopen-fail test.
2015-07-12 18:19:01 -04:00
Paul Smith
fe5585528f * job.c: [SV 43936] Check sigaction for error return. 2015-07-12 17:29:05 -04:00
Paul Smith
0205d3d08c [SV 45049] Check for '$' being the last character in a string.
* expand.c (variable_expand_string): Add a single '$' if '$' ends the
string.
* read.c (find_char_unquote, get_next_mword): Stop if '$' ends the
string.
* variable.c (parse_variable_definition): Ditto.
2015-07-12 13:25:16 -04:00
Paul Smith
9ef06be018 * read.c (unescape_char): [SV 45050] Handle final backslashes.
If the last thing in the string to be unescaped is a backslash,
stop without reading beyond the end of the string.
2015-07-12 12:39:59 -04:00
Paul Smith
ac9a39dad7 * strcache.c: [SV 45275] Handle very long strings.
Our previous behavior for handling too-long strings involved
increasing the size of the default string cache buffer, but the
implementation was incomplete.  Instead, create a one-off large
string cache entry and add it directly to the full cache list
without changing the default buffer size.
2015-07-12 00:14:19 -04:00
Duncan Moore
c6ac580785 * job.c [RISCOS]: Remove logic that is no longer required.
Signed-off-by: Paul Smith <psmith@gnu.org>
Copyright-paperwork-exempt: yes
2015-07-12 00:14:19 -04:00
Paul Smith
9efd477e98 * remake.c (update_file): [SV 44742] Keep double-colon rule status.
Fix suggested by Everett Boyer <EvBoyer@aol.com>
2015-07-12 00:14:14 -04:00
James Johnston
5036dd120a [SVN 45515] Check exit status of sub-make in subproc.bat
* subproc.bat: Exit when sub-make invocation fails.

Copyright-paperwork-exempt: yes
2015-07-10 09:56:27 +03:00
Eli Zaretskii
7e849f3b81 [SV 45515] Ignore Windows-specific build artifacts
* .gitignore: Ignore *.exe, *.dll.a, *.lib, *pdb, and a few more MSVC
specific artifacts.
Suggested by James Johnston <johnstonj.public@codenest.com>
2015-07-10 09:50:27 +03:00
Eli Zaretskii
a80a8b8a10 [SV 44348] Fix handling of shell widlcards on MS-Windows.
* job.c (construct_command_argv_internal): If shell wildcard
	characters are found inside a string quoted with "..", give up the
	fast route and go through the shell.  Fixes Savannah bug #44348.
2015-02-28 14:34:51 +02:00
John Malmberg
e4ac28e830 Fix bs-nl handling, exit and Environment for VMS.
This fix required a complete rewrite of the command parser vmsjobs.c
child_execute_job.  The old parser had too many incorrect assumptions
about DCL commands and could not be repaired to extended.

The parser now more closely parses VMS commands and handles quoted
commands and redirection.  Command File mode has been improved, but can
not fully support bs-nl syntax.

VMS Unix shell simulation has been improved.

* commands.c: vms_comma_separator is now a run-time setting.
* function.c: vms_comma_separator is now a run-time setting.
* function.c(func_basename_dir) now reports "[]" or "./" based on
  VMS crtl runtime setting.
* job.c(start_job_command): VMS Handle empty commands propery.
* main.c: Add VMS environment variables for run-time settings.
  * vms_legacy_behavior - Force older behavior.
  * vms_comma_separator - Commas or spaces for separators.
  * vms_unix_simulation - Enhanced Posix shell simulation features.
  * Detect if VMS CRTL is set to report Unix paths instead of VMS.
  * ':' and '>' are also MAP_DIRSEP on VMS.
* makeint.h: Add VMS run-time option variables.
* readme.vms: Update to current behavior.
* variable.c(define_variable_in_set): Fix VMS Environment variable
  lookup.
* variable.c(define_automatic_variables): Remove some VMS specific
  automatic variables and use the Unix ones instead.
* vms_export_symbol.c: Set max symbol size correctly.
* vmsjobs.c: child_execute_job() complete rewrite of VMS comand
  parsing.
* vmsjobs.c(build_vms_cmd): VMS commmand building with shell simulation.

Signed-off-by: Paul Smith <psmith@gnu.org>
2015-01-27 21:43:16 -05:00
Christian Boos
1fae20a2b7 Fix $(shell) on hosts with 64-bit pid_t.
* function.c: Use pid_t for shell_function_pid.
* job.c: Likewise.

Copyright-paperwork-exempt: yes
2014-12-27 10:55:01 +02:00
Paul Smith
292da6f686 * main.c (main): [SV 43434] Handle NULL returns from ttyname(). 2014-10-20 01:54:56 -04:00
Benedikt Morbach
3c487e7ed5 * tests/scripts/features/archives: [SV 43405] override AR variable.
Copyright-paperwork-exempt: yes
2014-10-20 01:45:09 -04:00
John Malmberg
c0380823a2 Fix VMS implicit rules and UNIX paths.
This fixes VMS implicit rules and UNIX style pathname handling.
It also fixes some of the VMS style pathname handling, more work
there will be needed later.
TODO: There are other case insensitive platforms besides VMS.
We need to find out why there is extra VMS code for this.  This
indicates either the extra VMS code is not needed, or the case
insensitive support may not be complete on the other case
insensitive platforms.

* default.c: Add missing definitions to default_suffix_rules[] and
default_variables[].
TODO: As it is important that VMS DCL mode definitions must always
be a superset of UNIX definitions, a better way of maintaining the
VMS DCL mode definitions should be devised.
* dir.c (downcase_inplace): Add a reentrant downcase() routine.
Add future support for VMS 8.2+ _USE_STD_STAT macro which will
disable a lot of VMS specific code from compiling.
(dir_file_exists_p): vmsify filename only if directory name has VMS
directory delimiters.
(file_exists_p): Handle both VMS and UNIX directories.
(file_impossible): Handle both VMS and Unix directories.  Track
whether a VMS format path is needed for the return value.
* file.c (lookup_file): Check if vmsify is needed; handle UNIX paths.
* implicit.c (pattern_search): Enable UNIX paths.
* read.c (parse_file_seq): Enable UNIX paths.
* remake.c (f_mtime): Fix gpath_search call for VMS paths.
* rule.c (count_implicit_rule): Enable UNIX paths, Fix VMS paths.
* vpath.c (selective_vpath_search): Enable UNIX paths.
2014-10-20 01:31:42 -04:00
John Malmberg
1faae1d4ed Update README.VMS and move news to the NEWS file
* NEWS: Merge in VMS history.
* README.VMS: Remove VMS history, document current behavior and
known issues.
2014-10-20 01:31:42 -04:00
John Malmberg
18eb093f56 [SV 41758]: Fix archive support for VMS.
Upated to match change to run_make_tests and some future fixes to
make on VMS.

* arscan.c: Use ANSI compatible pragmas instead of VAX C extensions.
* tests/scripts/features/archives: Fix tests to use VMS rules and
answers when running on VMS and using DCL as a shell.
* tests/scripts/features/vpath3: Fix epected answer on test when
run on VMS.
* tests/scripts/vms/library: (New) Test the VMS library rules that
are not tested by existing tests.
2014-10-20 01:31:42 -04:00
John Malmberg
894ee7f6c8 [SV 42447]: VMS simulate exporting symbols
This also includes fixing the most of the exit handling code for VMS.

Self tests:
 Previously about 94 Tests in 36 categories fail.
 Now about 45 tests in 22 categories fail.

Because some tests do not properly clean up, the number of tests that
fail can vary by one or two test cases between consecutive runs.

* Makefile.am: Add new VMS files.
* job.c: add prototype for vms_strsignal().
* job.c: (child_error): Remove VMS specific code as no longer needed.
* job.c: (reap_children): The VMS specific code was setting the
status to 0 instead of setting it to the proper exit status.
* job.h: Add vms_launch_status to struct child.
* main.c: (main): Use environment variables for options to use MCR
* instead of a foreign command, and to always use command files for
subprocesses.
For VMS use (set_program_name) routine which is common to ports of
other GNU packages to VMS to set the program name used internally.
Use (vms_putenv_symbol) to set up symbols to be visible in child
programs, including recursive make launched by execve()
Start of Bash shell detection code for VMS.
* makefile.com: Need nested_include=none for building on VMS search
lists.  Add vms_progname, vms_exit, and vms_export_symbol.
* makefile.vms: Need nested_include=none for building on VMS search
lists.  Add vms_progname, vms_exit, vms_export_symbol.
* makeint.h: Make sure non-standard "VMS" macro is defined.  Add
prototypes for new VMS routines.  Remove VMS-specific failure codes.
* vmsjobs.c: Add VMS POSIX exit code constants.
(_is_unixy_shell): Detect Bash shell.
(vms_strsignal): simulate strsignal() on VMS.
(vmsHandleChildTerm): fix to properly report failed LIB$SPAWN() exit
status codes.  Remove code that duplicated code in job.c.
(child_execute_job): Export environment symbols before spawning a
child and restore afterward unless option to use command files for
subprocesses is set.  Improve handling of UNIX null commands ":".
* vms_exit.c: Provides vms_exit() to detect if an exit code is UNIX
or VMS, and converts the UNIX code into a VMS exit code.
* vms_export_symbol.c: Routines to create DCL symbols that work like
shell aliases or exported shell symbols and clean them up on exit.
* vms_export_symbol_test.com: Unit test for vms_export_symbol.c
* vms_progname.c: New file: VMS specific replace for progname.c that
is used in some GNU projects.
2014-10-20 01:28:46 -04:00
John Malmberg
e75662bc6a Set up for running tests on VMS.
* run_make_tests.pl: set $port_type to be 'VMS-DCL' when the test are
run from the VMS DCL Interpreter.  When the tests are run from GNV
on VMS, the $port_type will be 'UNIX'.
* run_make_tests.com: VMS search list support.  This is needed for
using a search list such as prj_root = lcl_root:,vms_root:,src_root:
for building and testing.
2014-10-20 01:23:47 -04:00
Paul Smith
d1df4b21f3 * configure.ac, NEWS, README.git: Set up for the next release. 2014-10-09 02:06:53 -04:00
Paul Smith
a66bf2d736 GNU Make release 4.1. 2014-10-05 12:18:08 -04:00
Eli Zaretskii
31c2024b2e Fix Cygwin compilation error.
* job.c (construct_command_argv_internal) [HAVE_DOS_PATHS]: Fix
initializer for sh_chars_sh.
Reported by Denis Excoffier<cygwin@Denis-Excoffier.org>.
2014-10-02 18:11:43 +03:00
Gisle Vanem
7df0fe77d8 Fix last commit. 2014-10-01 20:43:12 +03:00
Gisle Vanem
9fc787c658 * makeint.h (ftruncate): Define also for __WATCOMC__.
Copyright-paperwork-exempt: yes.
2014-10-01 20:41:28 +03:00
Eli Zaretskii
1afb0ad372 Avoid compilation warnings.
* main.c (find_and_set_default_shell, main) [WINDOWS32]: Declare
variables 'const char *' to avoid compiler warnings.
* job.c (construct_command_argv_internal) [!NDEBUG]: Declare 'end'
and set it only if NDEBUG is not defined, to avoid compiler
warnings.
2014-10-01 18:34:29 +03:00
Eli Zaretskii
86a058029b Treat redirection of standard handles on Windows as it is done on Unix.
* job.c (start_job_command) [WINDOWS32]: Compute outfd and errfd
as on Posix platforms, and pass the results to process_easy.
* function.c (windows32_openpipe) [WINDOWS32]: Accept an
additional argument ERRFD and use it for redirecting the standard
error handle passed to the subprocess.
(func_shell_base) [WINDOWS32]: Pass the computed errfd to
windows32_openpipe.
2014-10-01 18:26:28 +03:00
Paul Smith
0a3a0756b9 Update Copyright statements for 2014. 2014-09-30 09:32:42 -04:00
Paul Smith
3712e8a819 * tests/scripts/features/load: Avoid unused variable warnings. 2014-09-30 09:32:41 -04:00
Paul Smith
9ed452b041 * loadapi.c (gmk_eval): Use C90 syntax. 2014-09-30 08:32:06 -04:00
Hartmut Becker
b11bef0bea * job.c: fix make action continuation lines.
* vmsjobs.c: fix writing DCL command files when trimming (white
  spaces and $ signs) especially after a split (command continuation).
2014-09-30 08:12:46 -04:00
Bernhard Reutner-Fischer
bd716a1ec1 * configure.ac: Fix spacing in helptext of customs
Copyright-paperwork-exempt: yes
2014-09-15 14:17:49 -04:00