bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exec doesn't restore terminal signals


From: Stephane Chazelas
Subject: Re: exec doesn't restore terminal signals
Date: Tue, 28 Jul 2015 13:26:11 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]