2015-07-28 11:48:54 +0200, Andreas Schwab: > Running exec in an interactive shell does not restore the terminal > signals TSTP, TTIN, TTOU, causing them to be ignored in the new command. > > $ trap > $ exec bash > $ trap > trap -- '' SIGTSTP > trap -- '' SIGTTIN > trap -- '' SIGTTOU > > Andreas. [...]
Note that it looks like in versions prior to 4.4, that test is not relevant as the output of trap seems to always include those lines. Most shells do ignore those signals (and SIGQUIT) in the shell process, but it's reset in child processes (note how you can't suspend builtins like read (though ksh93 lets you suspend its sleep builtin command) except in subshells). bash-4.3 and below erroneously reflects that in the trap output (4.2 seems to also include SIGQUIT). It seems to have been fixed in 4.4-alpha. The problem you mention is also present in 4.3, but a better way to test for it there would be: (Linux) ~$ bash --norc bash-4.3$ trap trap -- '' SIGTSTP trap -- '' SIGTTIN trap -- '' SIGTTOU bash-4.3$ grep SigIgn /proc/self/status SigIgn: 0000000000000000 bash-4.3$ exec grep SigIgn /proc/self/status SigIgn: 0000000000380000 ~$ Or: ~$ bash --norc bash-4.3$ bash -c trap bash-4.3$ exec bash -c trap trap -- '' SIGTSTP trap -- '' SIGTTIN trap -- '' SIGTTOU -- Stephane