summaryrefslogtreecommitdiffstats
path: root/scripts/jobserver-exec
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2022-11-14 19:10:55 +0100
committerMasahiro Yamada <masahiroy@kernel.org>2022-11-21 02:18:39 +0100
commitf8f4dc7685c72c8ef86420566a38a4f786613851 (patch)
treef983ca07c729a4b96ec277234e86aaa50fd253f1 /scripts/jobserver-exec
parentkconfig: remove redundant (void *) cast in search_conf() (diff)
downloadlinux-f8f4dc7685c72c8ef86420566a38a4f786613851.tar.xz
linux-f8f4dc7685c72c8ef86420566a38a4f786613851.zip
scripts/jobserver-exec: parse the last --jobserver-auth= option
In the GNU Make manual, the section "Sharing Job Slots with GNU make" says: Be aware that the MAKEFLAGS variable may contain multiple instances of the --jobserver-auth= option. Only the last instance is relevant. Take the last element of the array, not the first. Link: https://www.gnu.org/software/make/manual/html_node/Job-Slots.html Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Diffstat (limited to 'scripts/jobserver-exec')
-rwxr-xr-xscripts/jobserver-exec4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/jobserver-exec b/scripts/jobserver-exec
index 8762887a970c..4192855f5b8b 100755
--- a/scripts/jobserver-exec
+++ b/scripts/jobserver-exec
@@ -23,7 +23,9 @@ try:
opts = [x for x in flags.split(" ") if x.startswith("--jobserver")]
# Parse out R,W file descriptor numbers and set them nonblocking.
- fds = opts[0].split("=", 1)[1]
+ # If the MAKEFLAGS variable contains multiple instances of the
+ # --jobserver-auth= option, the last one is relevant.
+ fds = opts[-1].split("=", 1)[1]
reader, writer = [int(x) for x in fds.split(",", 1)]
# Open a private copy of reader to avoid setting nonblocking
# on an unexpecting process with the same reader fd.