bug-bash
[Top][All Lists]
Advanced

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

Re: Sporadic byte loss in read builtin


From: Chet Ramey
Subject: Re: Sporadic byte loss in read builtin
Date: Mon, 19 Mar 2018 11:28:08 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

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    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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