On 11/27/17 4:17 AM, Thiruvadi Rajaraman wrote:
> Hi,
>
> Found a 'sleep' execution issue with bash loadable builtins and has
> performed
> the below sleep test on bash-4.4-rc1.
That's an interesting one. It looks like the SIGCHLD interrupts the select
loop, even though bash supplies SA_RESTART when installing its SIGCHLD
handler. It's probably too hard to restart it in general, since select
doesn't necessarily modify its timeval argument when it returns early
(Linux does; many other OSs do not).
There is a problem with your fix in that, in most cases, you've just made
everything that uses this function non-interruptible, especially in an
interactive shell. I think a better fix would be to change fsleep() to cope
with select(2) being interrupted using the bash primitives that deal with
signal and trap handling.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/