diff --git a/jobserver-fifo.patch b/jobserver-fifo.patch index e418d0b..2cc6640 100644 --- a/jobserver-fifo.patch +++ b/jobserver-fifo.patch @@ -798,7 +798,7 @@ Index: make-4.3/src/posixos.c return 0; } -@@ -151,15 +247,23 @@ jobserver_parse_auth (const char *auth) +@@ -156,15 +252,23 @@ jobserver_parse_auth (const char *auth) char * jobserver_get_auth (void) { @@ -825,7 +825,7 @@ Index: make-4.3/src/posixos.c } void -@@ -173,6 +277,11 @@ jobserver_clear (void) +@@ -178,6 +282,11 @@ jobserver_clear (void) close (job_rfd); job_fds[0] = job_fds[1] = job_rfd = -1; @@ -837,7 +837,7 @@ Index: make-4.3/src/posixos.c } void -@@ -191,6 +300,7 @@ jobserver_release (int is_fatal) +@@ -196,6 +305,7 @@ jobserver_release (int is_fatal) unsigned int jobserver_acquire_all (void) { @@ -845,7 +845,7 @@ Index: make-4.3/src/posixos.c unsigned int tokens = 0; /* Use blocking reads to wait for all outstanding jobs. */ -@@ -203,19 +313,25 @@ jobserver_acquire_all (void) +@@ -208,19 +318,25 @@ jobserver_acquire_all (void) while (1) { char intake; @@ -874,7 +874,7 @@ Index: make-4.3/src/posixos.c { fd_inherit (job_fds[0]); fd_inherit (job_fds[1]); -@@ -226,7 +342,7 @@ jobserver_pre_child (int recursive) +@@ -231,7 +347,7 @@ jobserver_pre_child (int recursive) void jobserver_post_child (int recursive) { diff --git a/jobserver-noinherit.patch b/jobserver-noinherit.patch new file mode 100644 index 0000000..66621f1 --- /dev/null +++ b/jobserver-noinherit.patch @@ -0,0 +1,43 @@ +From d79fe162c009788888faaf0317253b6f0cac7092 Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Thu, 23 Apr 2020 17:05:34 -0400 +Subject: [PATCH] [SV 58232] Disable inheritance of jobserver FDs for recursive + make + +A parent make will invoke a sub-make with close-on-exec disabled for +the jobserver pipe FDs. Force close-on-exec to be to be enabled in +the sub-make so the pipe is not always passed to child jobs. + +I have a test case which, when invoked with a suitable -j switch, +will hang if the recipe inherits the jobserver pipe. This test case +was inspired by a real world case in which testing GDB on Fedora +would hang due to some poorly written test GDB cases having been +passed the jobserver file descriptors. + +* src/posixos.c (jobserver_parse_auth): Call fd_noinherit() for +jobserver pipe descriptors. + +Copyright-paperwork-exempt: yes +--- + src/posixos.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/posixos.c b/src/posixos.c +index 525f292c..eab175a4 100644 +--- a/src/posixos.c ++++ b/src/posixos.c +@@ -145,6 +145,11 @@ jobserver_parse_auth (const char *auth) + /* When using pselect() we want the read to be non-blocking. */ + set_blocking (job_fds[0], 0); + ++ /* By default we don't send the job pipe FDs to our children. ++ See jobserver_pre_child() and jobserver_post_child(). */ ++ fd_noinherit (job_fds[0]); ++ fd_noinherit (job_fds[1]); ++ + return 1; + } + +-- +2.37.2 + diff --git a/make.changes b/make.changes index 3550506..116b13f 100644 --- a/make.changes +++ b/make.changes @@ -1,7 +1,9 @@ ------------------------------------------------------------------- Wed Aug 17 15:05:38 UTC 2022 - Andreas Schwab -- jobserver-fifo.patch: Backport support for jobserver using named pipes +- jobserver-noinherit.patch: Disable inheritance of jobserver FDs for + recursive make +- jobserver-fifo.patch: Add support for jobserver using named pipes ------------------------------------------------------------------- Tue Apr 19 13:30:15 UTC 2022 - Marcus Meissner diff --git a/make.spec b/make.spec index 85a3106..4b73ffc 100644 --- a/make.spec +++ b/make.spec @@ -29,7 +29,8 @@ Source1: https://ftp.gnu.org/gnu/make/make-%{version}.tar.gz.sig Source2: %{name}.keyring Patch1: make-testcases_timeout.diff Patch2: fix-57962.patch -Patch3: jobserver-fifo.patch +Patch3: jobserver-noinherit.patch +Patch4: jobserver-fifo.patch Patch5: test-driver.patch Patch64: make-library-search-path.diff BuildRequires: autoconf @@ -50,6 +51,7 @@ The GNU make command with extensive documentation. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 %patch5 -p1 if [ %{_lib} = lib64 ]; then %patch64 -p1