From f4dfca490cb6d4b4fc7c6b977db56ab0d718de21 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 8 Mar 2016 18:18:05 +0000 Subject: 38114: Fix hang using ^Z with command subst. In subshells started to perform substitutions disable signals that require interactive handling. --- ChangeLog | 5 +++++ Src/exec.c | 13 +++++++++++-- 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 + + * 38114: Src/exec.c: In substitutions involving subshells, disable + signals that require interactive handling. + 2016-03-09 Jun-ichi Takimoto * 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. -- cgit 1.4.1