bug-bash
[Top][All Lists]
Advanced

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

Re: Why does "mapfile -d delim" (delim != '\n') use unbuffered read?


From: Chet Ramey
Subject: Re: Why does "mapfile -d delim" (delim != '\n') use unbuffered read?
Date: Fri, 7 May 2021 14:30:24 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0

On 5/7/21 1:32 PM, Koichi Murase wrote:

I don't think this will make much of a difference -- it never has,

I suspect it's because the buffered read was only enabled when delim
== '\n' before and read(2) has read exactly until the delimiter in
most cases. Now we have changed that condition, so I guessed we want
to be more careful.

I doubt it. The most common case is using delim == '\n' with a regular
file, in which case the zread calls will buffer far beyond the end of
the line. The zsyncfd fixed things up, but not until after the callback
execution. Since I never received any bug reports about that behavior, I
conclude that this change is not going to make much of a difference.

--
``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]