[Top][All Lists]

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

Re: Feature request for head command

From: Pádraig Brady
Subject: Re: Feature request for head command
Date: Wed, 21 Jun 2006 10:09:13 +0100
User-agent: Mozilla Thunderbird 1.0.8 (X11/20060502)

Eric Blake wrote:
>>When you use head to read a certain number of lines out of a pipe
>>sometimes it eats more data than you ask it to,
>>Well in the first case hello and world were immediately available to
>>be read and head -1 read them both into it's buffer before discovering
>>that actually it should have stopped at the first newline.
> There is nothing in POSIX that requires it to stop at the first newline,
> unless stdin is a terminal (in which case stdin defaulted to line-buffering).
> This issue has come up before, and it is more than just head that
> are affected - parsing for line ends slows down input, and complicates
> code, so it should only be done in a general wrapper utility (kind of
> like nice or nohup), rather than incorporated into every utility that
> can act as a filter:
> http://lists.gnu.org/archive/html/bug-coreutils/2006-03/msg00118.html
> But so far, no one has implemented something along those lines.

As I said already on that thread, I don't think
a wrapper program will help in this case, as
the child (glibc) will reinstantiate the default stdio buffering.


reply via email to

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