On Mon, Mar 01, 2010 at 12:58:05PM -0500, David Korn wrote: > > On Mon, Mar 01, 2010 at 11:18:56AM -0500, David Korn wrote: > > > Maybe the shell was started with SIGQUIT set to ignore. > > > > > > Remember that the shell ignores all signals that are set to ignore > > > at startup. > > > > What is the rationale for this? Besides compatibility with the POSIX > > shell. (I've long wondered about this.) > > I believe that the rational was related to the behavior of nohup. > A script that did > trap 'cleanup;exit' 2 1 0 > would terminate when run nohup without this if it received the HUP > signal.
Aha! SIGHUP is... a very intersting topic. On BSD systems SIGHUP is generated by vhangup(2) and/or the pty/tty driver when the master is closed / call is hungup. On Linux and Solaris the session leader is supposed to post SIGHUP to all process groups when it exits. (This difference has created problems for ssh users, but that's another topic. Suffice it to say that if the system has a revoke(2) system call then sshd should call that to revoke the pty slave as soon as the session leader of a session channel exits; alternatively the shell should do that, either instead of or in addition to sshd.) ISTM that nohup should be deprecated in favor of disown (though on Solaris that would really require getting revoke(2) implemented), and then the above rationale for not allowing trapping of initially ignore signals would disappear: SIGHUP isn't posted to disowned jobs, so there's no reason to avoid accidentally trapping a SIGHUP that will never arrive. Separately, how does disown work on *BSD? Thanks, Nico --