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 18:55:15 +0200

On Mon, Apr 9, 2018 at 3:38 PM, Chet Ramey <address@hidden> wrote:
> On 4/6/18 8:03 PM, john smith wrote:
>
>> 2. Why does busybox reboot make bash logout occasionally even if it
>> theoretically shouldn't because it does not detach from terminal?
>
> 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.  I've also learned that busybox reboot
behave similarly to Slackware reboot, that is it sends SIGTERM to init
which in turns sends SIGTERM to all processes but reboot itself
returns too late and bash gets SIGTERM when it's still before next
readline(), just as you said.
--
<address@hidden>



reply via email to

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