help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] readline does not always handle SIGTERM on reboot


From: john smith
Subject: Re: [Help-bash] readline does not always handle SIGTERM on reboot
Date: Mon, 9 Apr 2018 20:56:04 +0200

On Mon, Apr 9, 2018 at 7:51 PM, Chet Ramey <address@hidden> wrote:
> On 4/9/18 12:55 PM, john smith wrote:
>
>>> I don't run busybox, so I won't speculate. My first guess would be that
>>> the signal comes in while bash is ignoring SIGTERM (by catching the signal
>>> and discarding it).
>>
>> I've analyzed bash and readline during the weekend and I learned that
>> readline() overwrites bash SIGTERM handler and restores it after it
>> finishes, this is why `kill $$' does not kill the current session but
>> `(sleep 1; kill $$) &' does.
>
> You left out the part where readline resends the signal to the calling
> application, assuming the calling application hasn't set the signal
> handler to SIG_IGN (in which case readline would not install a handler
> for it at all).

Yes, I think I also got this.  I wondered why history is saved when I
simply close my xterm window, now I know that readline() resends
SIGHUP back to bash in _rl_handle_signal().
-- 
<address@hidden>



reply via email to

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