about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2022-04-29 20:25:53 -0700
committerBart Schaefer <schaefer@zsh.org>2022-04-29 20:25:53 -0700
commit15bf8ace168a86d0fae90b10e9f706baddd4c0bf (patch)
tree311f341dec249d4f6accccc8e56cebeb4121a02f
parent8eccdc5cb7311676820db5b03895f64748f33636 (diff)
downloadzsh-15bf8ace168a86d0fae90b10e9f706baddd4c0bf.tar.gz
zsh-15bf8ace168a86d0fae90b10e9f706baddd4c0bf.tar.xz
zsh-15bf8ace168a86d0fae90b10e9f706baddd4c0bf.zip
50134: Tweak process group handling to prevent unkillable pipelines
In some cases the process group leader of the forked-left side of a
pipe needs to be set to the pipe process PID rather than to the group
leader PID returned by entersubsh().
-rw-r--r--ChangeLog5
-rw-r--r--Src/jobs.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 586a951a0..7cf99072e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
-2022-04-29  Bart Schaefer  <schaefer@Macadamia>
+2022-04-29  Bart Schaefer  <schaefer@zsh.org>
+
+	* 50134: Src/jobs.c: Tweak process group handling (workers/43409)
+	to avoid creating "unkillable" pipelines that ignore signals
 
 	* unposted: Etc/BUGS: Details about STTY; consistency nit
 
diff --git a/Src/jobs.c b/Src/jobs.c
index af0a1233d..85d4c4d1f 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1476,7 +1476,10 @@ addproc(pid_t pid, char *text, int aux, struct timeval *bgtime,
 	 * set it for that, too.
 	 */
 	if (gleader != -1) {
-	    jobtab[thisjob].gleader = gleader;
+	    if (jobtab[thisjob].stat & STAT_CURSH)
+		jobtab[thisjob].gleader = gleader;
+	    else
+		jobtab[thisjob].gleader = pid;
 	    if (list_pipe_job_used != -1)
 		jobtab[list_pipe_job_used].gleader = gleader;
 	    /*