Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Luca Landi Newsgroups: gnu.bash.bug Subject: Job-control not fully working in subshells since v4.4 ? Date: Fri, 12 Jul 2019 21:06:40 +0200 Lines: 118 Approved: bug-bash@gnu.org Message-ID: References: <2044D16D-43CF-4A35-AE4A-C17DE7700A87@gif.it> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1562962443 14087 209.51.188.17 (12 Jul 2019 20:14:03 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org X-Mailer: Apple Mail (2.3273) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 89.31.73.190 X-Mailman-Approved-At: Fri, 12 Jul 2019 16:14:01 -0400 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <2044D16D-43CF-4A35-AE4A-C17DE7700A87@gif.it> Xref: csiph.com gnu.bash.bug:15148 Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security uname output: Linux ubuntu-14-04-4 4.2.0-42-generic #49~14.04.1-Ubuntu = SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 5.0 Patch Level: 7 Release Status: release Description: It appears that, since ca. v4.4, job-control from within an interactive = subshell is still allowed but does not work fully because the shell won't hand = over foreground-ness. Please consider the following demonstrative session run on a vanilla = 5.0.7. The first execution is from a non-interactive shell which will hand over foreground-ness to the subshell and below, while the second execution is from an interactive shell which will not do it: $ ./bash --norc --noprofile -c 'uname -a; echo $BASH_VERSION; (set -bm; = echo $-; sleep 3 & ps -s '$$' -o pid,ppid,pgid,tpgid,sid,s,cmd; wait); = echo end' Linux ubuntu-14-04-4 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 = 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux 5.0.7(1)-release bhmBc PID PPID PGID TPGID SID S CMD 1339 1270 1339 30211 1339 S -bash 30207 1339 30207 30211 1339 S ./bash --norc --noprofile -c uname = -a; echo $BASH_VERSION; (set -bm; echo $- 30209 30207 30207 30211 1339 S ./bash --norc --noprofile -c uname = -a; echo $BASH_VERSION; (set -bm; echo $- 30210 30209 30210 30211 1339 S sleep 3 30211 30209 30211 30211 1339 R ps -s 1339 -o = pid,ppid,pgid,tpgid,sid,s,cmd [1]+ Done sleep 3 end $ $ ./bash --norc --noprofile bash-5.0$ bash-5.0$ uname -a; echo $BASH_VERSION; (set -bm; echo $-; sleep 3 & ps = -s 1339 -o pid,ppid,pgid,tpgid,sid,s,cmd; wait); echo end Linux ubuntu-14-04-4 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 = 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux 5.0.7(1)-release bhimBHs PID PPID PGID TPGID SID S CMD 1339 1270 1339 30214 1339 S -bash 30212 1339 30212 30214 1339 S ./bash --norc --noprofile 30214 30212 30214 30214 1339 S ./bash --norc --noprofile 30215 30214 30215 30214 1339 S sleep 3 30216 30214 30216 30214 1339 R ps -s 1339 -o = pid,ppid,pgid,tpgid,sid,s,cmd end bash-5.0$ $ I get same result on v4.4.20(1) stock on Ubuntu 18.04 as well as on = 5.0.3(1) on Ubuntu 19.04. On Bash 4.3 stock on Ubuntu 16.04 (and 14.04 also tested) instead, = everything seems all right: $ bash -c 'uname -a; echo $BASH_VERSION; (set -bm; echo $-; sleep 3 & ps = -s '$$' -o pid,ppid,pgid,tpgid,sid,s,cmd; wait); echo end' Linux ubuntu-16-04 4.4.0-154-generic #181-Ubuntu SMP Tue Jun 25 05:29:03 = UTC 2019 x86_64 x86_64 x86_64 GNU/Linux 4.3.48(1)-release bhmBc PID PPID PGID TPGID SID S CMD 1885 1879 1885 2667 1885 S bash 2663 1885 2663 2667 1885 S bash -c uname -a; echo = $BASH_VERSION; (set -bm; echo $-; sleep 3 & ps -s 1885 -o = pid,ppid,pgid,tpgid,sid,s,cmd; 2665 2663 2663 2667 1885 S bash -c uname -a; echo = $BASH_VERSION; (set -bm; echo $-; sleep 3 & ps -s 1885 -o = pid,ppid,pgid,tpgid,sid,s,cmd; 2666 2665 2666 2667 1885 S sleep 3 2667 2665 2667 2667 1885 R ps -s 1885 -o = pid,ppid,pgid,tpgid,sid,s,cmd [1]+ Completato sleep 3 end $ $ uname -a; echo $BASH_VERSION; (set -bm; echo $-; sleep 3 & ps -s $$ -o = pid,ppid,pgid,tpgid,sid,s,cmd; wait); echo end Linux ubuntu-16-04 4.4.0-154-generic #181-Ubuntu SMP Tue Jun 25 05:29:03 = UTC 2019 x86_64 x86_64 x86_64 GNU/Linux 4.3.48(1)-release bhimBH PID PPID PGID TPGID SID S CMD 1885 1879 1885 2698 1885 S bash 2696 1885 2696 2698 1885 S bash 2697 2696 2697 2698 1885 S sleep 3 2698 2696 2698 2698 1885 R ps -s 1885 -o = pid,ppid,pgid,tpgid,sid,s,cmd end $ I suppose v4.3's behavior is the correct one ? Repeat-By: Sample sequence of commands as in below (mind the $$ of course): echo start; (set -bm; echo $-; sleep 3 & ps -s $$ -o = pid,ppid,pgid,tpgid,sid,s,cmd; wait); echo end