[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pending signal after rl_callback_read_char
From: |
Simon Marchi |
Subject: |
Re: pending signal after rl_callback_read_char |
Date: |
Tue, 11 Oct 2022 15:35:21 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 |
On 10/11/22 11:19, Chet Ramey wrote:
> On 9/30/22 11:11 AM, Chet Ramey wrote:
>> On 9/20/22 3:13 PM, Simon Marchi wrote:
>>
>>> I think that it could be fixed in readline by doing the following when
>>> reinstalling the old signal handlers:
>>>
>>> - block signals
>>> - call RL_CHECK_SIGNALS
>>> - restore old handlers
>>> - unblock signals
>>
>> Readline could probably get most or all of the way there by modifying
>> CALLBACK_READ_RETURN to call rl_check_signals/RL_CHECK_SIGNALS after
>> calling rl_clear_signals and before the return. What do you think?
>
> I'm getting back to looking at this. I've attached a patch that does this.
> Try it out and let me know.
Hi Chet,
As far as I understand, this is equivalent to the fix we've done in GDB
here:
https://gitlab.com/gnutools/binutils-gdb/-/commit/faf01aee1d03aef5b6f95fd0db358bf5e70578f9
So, it seems fine to me.
While reviewing this code, a question popped: given that readline only
records a single signal number in _rl_caught_signal, what happens if two
different signals (say, SIGINT and SIGWINCH) arrive in between two
RL_CHECK_SIGNALS? Won't it cause the second signal number to overwrite
the first one, and the first one to be missed?
Simon