On 3/19/18 3:12 AM, Rob Foehl wrote:
> The attached script will provoke an occasional loss of a single byte when
> the read builtin is used with a timeout. >
        [...]
> 
> This happens at random intervals on all machines I've tested with a 4.4
> release, including 4.4.19 on current Fedora 27.  Curiously, it seems to
> reliably return none of the read bytes but still consumes all input (and
> terminates) when run on various earlier 4.x releases, at least with the
> default timing parameters.
> 
> The missing byte(s) are always the last read prior to a SIGALRM.  Poking
> around in builtins/read.def, I'd guess that it's due to one of the
> CHECK_ALRM calls between the actual read and the update to input_string
> causing this bit to run with i == 0:

You're right, the `read' builtin is too aggressive checking for SIGALRM.
It should wait until after it stores the character in input_string (or
otherwise processes it) before checking for SIGALRM.

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

Reply via email to