bug-coreutils
[Top][All Lists]
Advanced

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

Re: Cat and -u, unbuffered output support


From: Scott Bronson
Subject: Re: Cat and -u, unbuffered output support
Date: 23 Jun 2003 23:56:53 -0700

Thanks for the reply, Bob!  Maybe I'm misunderstanging the meaning of
"unbuffered".  First, the vital statistics:

   address@hidden:~$ cat --version
   cat (coreutils) 5.0
   ...
   address@hidden:~$ uname -a
   Linux vesper 2.4.20 #9 Sun Mar 30 11:29:43 PST 2003 i686 GNU/Linux

Now, I want cat to send its data immediately, rather than waiting for a
newline.  Here's an illustration that can be run in a single shell:

   % mkfifo fi
   % cat -u fi &
   % cat -u > fi

Now, if cat wrote each byte from the input to the output without delay,
then typing "abc\n" into the fifo would produce "aabbcc\n\n" on the
screen.  Each character would be sent through the pipe and echoed
immediately.

However, the result of typing "abc\n" is "abc\nabc\n".  This implies
that SOMEBODY (perhaps I was too hasty in implicating cat) is buffering
the bytes up to the newline, then sending them in one big burst.  Is
this the expected behavior?

    - Scott


On Mon, 2003-06-23 at 21:29, Bob Proulx wrote:
> Scott Bronson wrote:
> > Hello.  It is driving me nuts that GNU cat doesn't support the -u
> > option.  It it makes it difficult to port software from other Unix
> > systems to GNU.
> 
> But '-u' *is* accepted as a valid option to cat.  It is ignored since
> "Write bytes from the input file to the standard output without delay
> as each is read." as required by the standards is always the default
> with GNU cat.  I don't see how this could be causing a portability
> problem for you.  Scripts calling for 'cat -u' should work fine.
> 
> > Is there any reason that you chose to remove the -u feature?
> > Would you accept a patch to add it back?
> 
> Would you be so kind as to double check the version of 'cat' that you
> are using?  And also perhaps what OS you are running on if that is
> important?  This feature of 'cat' does not appear to have changed for
> a very long time.  I suspect that you are not actually using GNU cat
> at all!
> 
>   cat --version
> 
>   uname -a
> 
> Bob
> 
> P.S. Note that the latest version is available here:
> 
>   http://ftp.gnu.org/pub/gnu/coreutils/
-- 
Scott Bronson <address@hidden>





reply via email to

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