make/tests/scripts/variables
Paul Smith 16e14b4114 Disable the jobserver in non-recursive children
Savannah issues such as SV 57242 and SV 62397 show how passing
references to closed file descriptors via the --jobserver-auth option
in MAKEFLAGS can lead to problematic outcomes.

When computing the child environment for a non-recursive shell, add
an extra option to MAKEFLAGS to disable the file descriptors for the
jobserver.

Unfortunately this doesn't modify the value of the make variable
MAKEFLAGS, it only modifies the value of the sub-shell environment
variable MAKEFLAGS.  This can lead to confusion if the user is not
considering the distinction.

* src/makeint.h: Publish the jobserver-auth value.  Add a global
definition of the name of the command line option.
* src/os.h (jobserver_get_invalid_auth): New function to return a
string invalidating the jobserver-auth option.
* src/w32/w32os.c (jobserver_get_invaid_auth): Implement it.  On
Windows we use a semaphore so there's no need to invalidate.
* src/posixos.c (jobserver_parse_auth): If we parse the invalid
auth string, don't set up the jobserver.
(jobserver_get_invalid_auth): Return an invalid option.
* src/variable.h (target_environment): Specify if the target
environment is for a recursive shell or non-recursive shell.
* src/variable.c (target_environment): Move checking for MAKELEVEL
into the loop rather than doing it at the end.
Along with this, check for MAKEFLAGS and MFLAGS, and update them
based on whether we're invoking a recursive or non-recursive child,
and also on whether it's necessary to invalidate the jobserver.
* src/function.c (func_shell_base): Shell functions can never be
recursive to pass 0 to target_environment().
* src/job.c (start_job_command): Specify whether the child is
recursive when calling target_environment().
* src/main.c: Export jobserver_auth.  sync_mutex doesn't need to
be exported.  Use the global definition for the option name.
* tests/scripts/variables/MAKEFLAGS: Add tests for $MAKEFLAGS.
2022-07-30 18:40:28 -04:00
..
automatic [SV 62324] Simplify set_file_variables by passing in the stem 2022-04-24 10:39:32 -04:00
CURDIR Refresh the test suite framework implementation. 2019-09-16 08:25:33 -04:00
DEFAULT_GOAL Convert all "`'" quotes to "''" per new GNU Coding Standard guidelines. 2012-03-04 00:24:20 +00:00
define Add support for the POSIX :::= assignment operator. 2021-09-20 00:29:31 -04:00
EXTRA_PREREQS Support the .EXTRA_PREREQS special variable 2020-01-03 02:08:59 -05:00
flavors Add support for the POSIX :::= assignment operator. 2021-09-20 00:29:31 -04:00
GNUMAKEFLAGS Don't add GNUMAKEFLAGS to the environment 2022-06-19 14:35:27 -04:00
INCLUDE_DIRS [SV 45211] Parse MAKEFLAGS immediately when it's reset 2021-09-05 21:08:59 -04:00
LIBPATTERNS Convert all "`'" quotes to "''" per new GNU Coding Standard guidelines. 2012-03-04 00:24:20 +00:00
MAKE Convert all "`'" quotes to "''" per new GNU Coding Standard guidelines. 2012-03-04 00:24:20 +00:00
MAKE_RESTARTS * tests/scripts/variables/MAKE_RESTARTS: Remove TAB chars 2022-02-27 18:01:13 -05:00
MAKECMDGOALS * A few script fixes and updates for 3.78. 1999-09-17 03:15:37 +00:00
MAKEFILES Add test suite support to Windows 2017-06-04 18:37:20 -04:00
MAKEFLAGS Disable the jobserver in non-recursive children 2022-07-30 18:40:28 -04:00
MAKELEVEL Fix for bug #1276: Handle SHELL according to POSIX requirements. 2004-11-28 23:11:23 +00:00
MFILE_LIST [SV 50823] Support filenames containing '$' in MAKEFILE_LIST 2017-06-04 18:37:21 -04:00
negative Add support for the POSIX :::= assignment operator. 2021-09-20 00:29:31 -04:00
private cosmetics: fix few innocuous typos 2013-05-05 20:50:37 -04:00
SHELL Support "unexport" in target-specific variables. 2020-11-29 17:57:33 -05:00
special * job.c (child_error): Combine file info with error message. 2016-03-20 14:23:22 -04:00
undefine [SV 59870] define/undefine prerequisites are not target-specific vars 2021-03-14 16:35:38 -04:00