Path: csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail From: konsolebox Newsgroups: gnu.bash.bug Subject: Re: Script shell suspends after executing second child process Date: Sun, 15 Nov 2015 01:39:04 +0800 Lines: 39 Approved: bug-bash@gnu.org Message-ID: References: <5644F35F.2050507@case.edu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: usenet.stanford.edu 1447580516 26708 208.118.235.17 (15 Nov 2015 09:41:56 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash To: Chester Ramey Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=pUQvY1smMhSF3x5N56W6MCKm3ySRBqhawdO0B/uksYE=; b=rIx3w3xCYqZnS+jOGoecPBS0WTD7vj+Xfs2RSOODXu31+fpxa2PACjIPBQ3SwHcHeg j1e0PXdyc1h/5lMy26oGMjebAPGuQnGRiOJqMG5yRS3prXiVgGfAWWCDaWf08OnvqwXX XZqg9sO7kKiv8SaDHeY/6WwHOHzsF12oxALw3FdIcdQEzyCyk9Iosj3+6p2ixy9BErxY BRcC/TAZRkTnxIE+SS/hP2Q4rWUC76IS7xXxrV+pwE57IkEHIHET+8BW/GXC+AqyBSss im50wBFU0AZ+mRtTFXYQPqyz0Kd+dbPcBh3YJKOL4zeF1F28CjBgrwYEskUsTjoRRk5Z QoOQ== X-Received: by 10.194.243.170 with SMTP id wz10mr27895735wjc.80.1447522744312; Sat, 14 Nov 2015 09:39:04 -0800 (PST) In-Reply-To: <5644F35F.2050507@case.edu> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c09::22b X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11880 On Fri, Nov 13, 2015 at 4:15 AM, Chet Ramey wrote: > On 11/12/15 5:27 AM, konsolebox wrote: >> My interactive (using `read`) Bash-script application still suspends >> itself after >> executing second instance of a player. I've only seen this happen in >> the newest development version of Bash. > > According to the change log, the last time I made a change that might > be relevant to this problem was April 23. You might try getting the > version immediately preceding that one and seeing whether or not that > version has the problem. > This seems to be the modification that causes the problem. It's in "commit bash-20150424 snapshot". --- a/jobs.c +++ b/jobs.c @@ -2658,8 +2658,8 @@ itrace("wait_for: blocking wait for %d returns %d child = %p", (int)pid, r, chil if (job == NO_JOB) itrace("wait_for: job == NO_JOB, giving the terminal to shell_pgrp (%ld)", (long)shell_pgrp); #endif - /* Don't modify terminal pgrp if we are running in the background */ - if (running_in_background == 0) + /* Don't modify terminal pgrp if we are running in background or a subshell */ + if (running_in_background == 0 && subshell_environment == 0) give_terminal_to (shell_pgrp, 0); } It seems to me that the new code prevents the subshell from having a different terminal control from its parent shell. In other words, no isolation happens. I'm not sure about the rationale but, should we at least not do it in subshells induced by process substitution and command substitution? Just my quick thoughts. I'll still look more into it.