about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2016-03-08 18:18:05 +0000
committerPeter Stephenson <pws@zsh.org>2016-03-09 09:51:14 +0000
commitf4dfca490cb6d4b4fc7c6b977db56ab0d718de21 (patch)
treee1ea3ede38fa0a02cfeeb5dbbca64fccf3441eda
parent4b6a79887d7db0ea126435095b7fdcd357aa2540 (diff)
downloadzsh-f4dfca490cb6d4b4fc7c6b977db56ab0d718de21.tar.gz
zsh-f4dfca490cb6d4b4fc7c6b977db56ab0d718de21.tar.xz
zsh-f4dfca490cb6d4b4fc7c6b977db56ab0d718de21.zip
38114: Fix hang using ^Z with command subst.
In subshells started to perform substitutions disable signals
that require interactive handling.
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c13
2 files changed, 16 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c77de2c7..be61bd073 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-08  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 38114: Src/exec.c: In substitutions involving subshells, disable
+	signals that require interactive handling.
+
 2016-03-09  Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
 
 	* unposted: .gitignore: update for 38108
diff --git a/Src/exec.c b/Src/exec.c
index b60fc90bd..50eff72cb 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -994,9 +994,18 @@ entersubsh(int flags)
     if ((flags & ESUB_REVERTPGRP) && getpid() == mypgrp)
 	release_pgrp();
     shout = NULL;
-    if (!job_control_ok) {
+    if (flags & ESUB_NOMONITOR) {
 	/*
-	 * If this process is not goign to be doing job control,
+	 * Allowing any form of interactive signalling here is
+	 * actively harmful as we are in a context where there is no
+	 * control over the process.
+	 */
+	signal_ignore(SIGTTOU);
+	signal_ignore(SIGTTIN);
+	signal_ignore(SIGTSTP);
+    } else if (!job_control_ok) {
+	/*
+	 * If this process is not going to be doing job control,
 	 * we don't want to do special things with the corresponding
 	 * signals.  If it is, we need to keep the special behaviour:
 	 * see note about attachtty() above.