2021年2月10日(水) 23:40 Chet Ramey <chet.ra...@case.edu>: > On 2/10/21 10:21 AM, Chet Ramey wrote: > > Thanks for the analysis and patch. I'll take a look. At first glance, I > > would like to find a simpler way to do it.
Thank you. Yes, if there is a simpler but still robust and reliable way to do it, that would be nice. Anyway, I want to see an authentic fix but not a partial fix (that looks to work in "most" cases). With a partial fix, there could be some special use cases where the failure rate becomes non-negligible, such as the test case for this time against the previous partial fix. > I'd also like to know how this is going to work with read -e and readline, > since those don't seem to know anything about the timer. OK, that is a good point. I completely forgot about `read -e'. I took a look at `rl_getc (stream)' (lib/readline/input.c). If one wants to switch to this approach, the timeout needs to be specified for the pselect(2) calls in `rl_getc ()'. In that case, I think readline could provide a proper public interface to accept the setting of the timeout. Because readline might be linked with different versions of Bash, the handling of SIGALRM in readline can be left as is, but the new interface for the timeout can be just added? -- Koichi