bug-readline
[Top][All Lists]
Advanced

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

Re: pending signal after rl_callback_read_char


From: Chet Ramey
Subject: Re: pending signal after rl_callback_read_char
Date: Tue, 20 Sep 2022 15:54:12 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.2

On 9/20/22 3:13 PM, Simon Marchi wrote:

It could be a timing issue: the signal arrives after rl_callback_read_char
checks for it and before it returns, but there's not a lot it can do about
that. That's why we have rl_check_signals() now.

That's what I think, there's a window in rl_callback_read_char after the
last time rl_check_signals was called, but before the original (user's)
signal handlers are put back in place.  If the SIGINT arrives during
that window, it will go unnoticed until the next call to
rl_callback_read_char (or some other readline function).

        [...]

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

That's more of a change than I'm willing to make before readline-8.2 is
released. In the meantime, you could look at rl_persistent_signal_handlers,
which, in theory, should work on readline versions >= 7.0.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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