[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Parent shell gets stopped when a child shell is created with job control
From: |
Eduardo A . Bustamante López |
Subject: |
Parent shell gets stopped when a child shell is created with job control but not interactive (bash -mc) |
Date: |
Fri, 28 Feb 2014 09:00:13 -0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
This works fine:
address@hidden:~$ ~/local/bin/bash -s <<< 'for i in . .; do (~/local/bin/bash
-mic ": & wait") ; done'
[1] 1629
[1]+ Done :
[1] 1631
[1]+ Done :
-----
This does not:
address@hidden:~$ ~/local/bin/bash -s <<< 'for i in . .; do (~/local/bin/bash
-mc ": & wait") ; done'
[1]+ Done :
[1]+ Stopped ~/local/bin/bash -s <<< 'for i in . .; do
(~/local/bin/bash -mc ": & wait") ; done'
-----
Here's my OS and bash information (bash is
2e4d3851f76a94dfc21af046e0dfd84b954b0f50, from devel)
address@hidden:~$ cat /etc/debian_version
7.3
address@hidden:~$ uname -a
Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
address@hidden:~$ ~/local/bin/bash --version
GNU bash, version 4.3.0(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
-----
Here's a sample output from strace when running this (I removed lots
of lines, didn't want to flood the list):
strace -fo bash-mc.log ~/local/bin/bash -s <<< 'for i in . .; do
(~/local/bin/bash -mc ": & wait") ; done'
29747 execve("/home/dualbus/local/bin/bash", ["/home/dualbus/local/bin/bash",
"-s"], [/* 24 vars */]) = 0
29747 brk(0) = 0x149c000
29747 rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
[...] 1st child
29747 clone(child_stack=0,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x7f58bff209d0) = 29748
29747 rt_sigprocmask(SIG_SETMASK, [], <unfinished ...>
29748 rt_sigprocmask(SIG_SETMASK, [], <unfinished ...>
29747 <... rt_sigprocmask resumed> NULL, 8) = 0
29747 rt_sigprocmask(SIG_BLOCK, [CHLD], <unfinished ...>
29748 <... rt_sigprocmask resumed> NULL, 8) = 0
29748 rt_sigaction(SIGTSTP, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0},
<unfinished ...>
29747 <... rt_sigprocmask resumed> [], 8) = 0
29748 <... rt_sigaction resumed> {SIG_DFL, [], 0}, 8) = 0
29747 rt_sigprocmask(SIG_SETMASK, [], <unfinished ...>
29748 rt_sigaction(SIGTTIN, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0},
<unfinished ...>
29747 <... rt_sigprocmask resumed> NULL, 8) = 0
29747 rt_sigprocmask(SIG_BLOCK, [CHLD], <unfinished ...>
[...] lots of stuff
29748 open("/home/dualbus/local/share/locale/en_US/LC_MESSAGES/bash.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
29748 open("/home/dualbus/local/share/locale/en/LC_MESSAGES/bash.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)
29748 write(2, "[1]+ Done :\n", 32) = 32
29748 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
29748 rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD], 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29748 --- SIGCHLD (Child exited) @ 0 (0) ---
29748 wait4(-1, 0x7fff8fdcad80, WNOHANG|WSTOPPED|WCONTINUED, NULL) = -1 ECHILD
(No child processes)
29748 rt_sigreturn(0xffffffffffffffff) = 0
29748 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29748 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29748 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29748 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29748 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29748 setpgid(0, 29746) = 0
29748 exit_group(0) = ?
29747 <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) =
29748
29747 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0},
{0x460380, [], SA_RESTORER, 0x7f58bf5914f0}, 8) = 0
29747 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29747 --- SIGCHLD (Child exited) @ 0 (0) ---
29747 wait4(-1, 0x7ffff870cd80, WNOHANG, NULL) = -1 ECHILD (No child processes)
29747 rt_sigreturn(0xffffffffffffffff) = 0
29747 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29747 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29747 rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
29747 clone(child_stack=0,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x7f58bff209d0) = 29750
29747 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29747 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29747 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29747 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29747 rt_sigaction(SIGINT, {0x460380, [], SA_RESTORER, 0x7f58bf5914f0},
{SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0}, 8) = 0
29747 wait4(-1, <unfinished ...>
29750 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29750 rt_sigaction(SIGTSTP, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0},
{SIG_DFL, [], 0}, 8) = 0
29750 rt_sigaction(SIGTTIN, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0},
{SIG_DFL, [], 0}, 8) = 0
29750 rt_sigaction(SIGTTOU, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0},
{SIG_DFL, [], 0}, 8) = 0
29750 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0},
{SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0}, 8) = 0
29750 rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0},
{SIG_IGN, [], SA_RESTORER, 0x7f58bf5914f0}, 8) = 0
29750 rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER|SA_RESTART,
0x7f58bf5914f0}, {0x4628b0, [], SA_RESTORER|SA_RESTART, 0x7f58bf5914f0}, 8) = 0
29750 rt_sigaction(SIGCHLD, {0x4628b0, [], SA_RESTORER|SA_RESTART,
0x7f58bf5914f0}, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f58bf5914f0}, 8) = 0
29750 rt_sigaction(SIGINT, {0x4862b0, [], SA_RESTORER, 0x7f58bf5914f0},
{SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0}, 8) = 0
29750 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
29750 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29750 rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
29750 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
29750 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0},
{0x4862b0, [], SA_RESTORER, 0x7f58bf5914f0}, 8) = 0
29750 rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0},
{SIG_DFL, [], SA_RESTORER, 0x7f58bf5914f0}, 8) = 0
29750 rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER|SA_RESTART,
0x7f58bf5914f0}, {0x4628b0, [], SA_RESTORER|SA_RESTART, 0x7f58bf5914f0}, 8) = 0
29750 execve("/home/dualbus/local/bin/bash", ["/home/dualbus/local/bin/bash",
"-mc", ": & wait"], [/* 24 vars */]) = 0
29750 brk(0) = 0x9a8000
[...] before the loop
29750 stat(".", {st_mode=S_IFDIR|0770, st_size=4096, ...}) = 0
29750 getpid() = 29750
29750 open("/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
29750 fstat(3, {st_mode=S_IFREG|0644, st_size=26066, ...}) = 0
29750 mmap(NULL, 26066, PROT_READ, MAP_SHARED, 3, 0) = 0x7f276537f000
29750 close(3) = 0
29750 getppid() = 29747
29750 brk(0x9af000) = 0x9af000
29750 brk(0x9b0000) = 0x9b0000
29750 brk(0x9b1000) = 0x9b1000
29750 getpgrp() = 29746
29750 dup(2) = 3
29750 getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=4*1024}) = 0
29750 fcntl(255, F_GETFD) = -1 EBADF (Bad file descriptor)
29750 dup2(3, 255) = 255
29750 close(3) = 0
29750 ioctl(255, TIOCGPGRP, [29748]) = 0
29750 rt_sigaction(SIGTTIN, {SIG_DFL, [], SA_RESTORER, 0x7f27649e34f0},
{0x462a10, [], SA_RESTORER, 0x7f27649e34f0}, 8) = 0
29750 kill(0, SIGTTIN) = 0
29750 --- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
29750 --- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
29750 rt_sigaction(SIGTTIN, {0x462a10, [], SA_RESTORER, 0x7f27649e34f0},
{SIG_DFL, [], SA_RESTORER, 0x7f27649e34f0}, 8) = 0
29750 ioctl(255, TIOCGPGRP, [29748]) = 0
29750 rt_sigaction(SIGTTIN, {SIG_DFL, [], SA_RESTORER, 0x7f27649e34f0},
{0x462a10, [], SA_RESTORER, 0x7f27649e34f0}, 8) = 0
29750 kill(0, SIGTTIN) = 0
29750 --- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
29750 --- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
29750 rt_sigaction(SIGTTIN, {0x462a10, [], SA_RESTORER, 0x7f27649e34f0},
{SIG_DFL, [], SA_RESTORER, 0x7f27649e34f0}, 8) = 0
29750 ioctl(255, TIOCGPGRP, [29748]) = 0
29750 rt_sigaction(SIGTTIN, {SIG_DFL, [], SA_RESTORER, 0x7f27649e34f0},
{0x462a10, [], SA_RESTORER, 0x7f27649e34f0}, 8) = 0
29750 kill(0, SIGTTIN) = 0
29750 --- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
29750 --- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
29750 rt_sigaction(SIGTTIN, {0x462a10, [], SA_RESTORER, 0x7f27649e34f0},
{SIG_DFL, [], SA_RESTORER, 0x7f27649e34f0}, 8) = 0
29750 ioctl(255, TIOCGPGRP, [29748]) = 0
29750 rt_sigaction(SIGTTIN, {SIG_DFL, [], SA_RESTORER, 0x7f27649e34f0},
{0x462a10, [], SA_RESTORER, 0x7f27649e34f0}, 8) = 0
29750 kill(0, SIGTTIN) = 0
29750 --- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
29750 --- SIGTTIN (Stopped (tty input)) @ 0 (0) ---
29750 rt_sigaction(SIGTTIN, {0x462a10, [], SA_RESTORER, 0x7f27649e34f0},
{SIG_DFL, [], SA_RESTORER, 0x7f27649e34f0}, 8) = 0
29750 ioctl(255, TIOCGPGRP, [29748]) = 0
29750 rt_sigaction(SIGTTIN, {SIG_DFL, [], SA_RESTORER, 0x7f27649e34f0},
{0x462a10, [], SA_RESTORER, 0x7f27649e34f0}, 8) = 0
[...] goes on forever
I can provide the full log in case it's needed. Beware that this bug
seems to hang strace (had to kill -9 it) and when run under gdb while
set follow-fork-mode child, gdb seemed to die, and then two shells
were running at the same time.
By the way, are compressed log file attachments OK in this list?
--
Eduardo Alan Bustamante López
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Parent shell gets stopped when a child shell is created with job control but not interactive (bash -mc),
Eduardo A . Bustamante López <=