bug-bash
[Top][All Lists]
Advanced

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

Re: bash doesn't send SIGHUP to children


From: Chet Ramey
Subject: Re: bash doesn't send SIGHUP to children
Date: Thu, 11 Sep 2008 15:51:33 -0400

> On 4 September 2008, Chet Ramey <chet.ramey@case.edu> wrote:
> > > Description:
> > >   Regradless of the huponexit setting ('shopt -s huponexit' doesn't
> > >         help) bash does not send SIGHUP to its children when it receives 
> > > one
> > >         itself. Previous version of bash 3.1.17 was behaving properly
> > >         even with huponexit set to off
> > > 
> > > Repeat-By:
> > >   launch rxvt, launch mc then close the rxvt window -> 
> > >   mc is still running with CPU to 100% (this is because 
> > >         mc tries to read from stdin while receiving EOF)
> > >   Closing rxvt sends SIGHUP to bash but bash doesn't send
> > >   SIGHUP to its children

I can't reproduce what you're seeing.  Here's what I get:

bash strace (partial -- the waitpid is it waiting for mc, pid 28775)

waitpid(-1, 0xbf96a378, WSTOPPED|WCONTINUED) = ? ERESTARTSYS (To be restarted)
--- SIGHUP (Hangup) @ 0 (0) ---
--- SIGCONT (Continued) @ 0 (0) ---
sigreturn()                             = ? (mask now [CHLD])
stat64("/home/chet/.bash_history", {st_mode=S_IFREG|0600, st_size=2315, ...}) = 0
open("/home/chet/.bash_history", O_WRONLY|O_APPEND|O_LARGEFILE) = -1 EACCES 
(Permission denied)
open("/home/chet/.bash_history", O_RDONLY|O_LARGEFILE) = -1 EACCES (Permission 
denied)
kill(-28775, SIGHUP)                    = 0
rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [CHLD], 8) = 0
ioctl(255, TIOCSPGRP, [28757])          = -1 ENOTTY (Inappropriate ioctl for 
device)
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
setpgid(0, 28757)                       = -1 EPERM (Operation not permitted)
rt_sigaction(SIGHUP, {SIG_DFL}, {0x8092110, [HUP INT ILL TRAP ABRT BUS FPE USR1 
SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], 0}, 8) = 0
kill(28757, SIGHUP)                     = 0
--- SIGHUP (Hangup) @ 0 (0) ---
Process 28757 detached

mc trace:

Process 28775 attached - interrupt to quit
select(5, [3 4], NULL, NULL, NULL)      = 1 (in [3])
rt_sigaction(SIGINT, {SIG_IGN}, NULL, 8) = 0
select(5, [3 4], NULL, NULL, NULL)      = 1 (in [3])
--- SIGHUP (Hangup) @ 0 (0) ---
Process 28775 detached

I am wondering about a few things from your trace.  First, why is bash
reading from fd 3?  That implies a non-interactive shell, possibly without
job control.  The `huponexit' option only works with interactive login
shells.  The SIGHUP handler only resends SIGHUP to jobs when the shell is
interactive -- it's often not the right thing to send them to all children
when the shell is not interactive.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    chet@case.edu    http://tiswww.tis.case.edu/~chet/




reply via email to

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