On Thu, Dec 20, 2007 at 05:40:11AM -0500, Mikhail Teterin wrote:
> On ?????? 20 ??????? 2007, Max N. Boyarov wrote: = | MT> Is not that
> a bug in itself?  = = | Tail write buffer at all, i.e. all 10 lines
> writes to pipe.
>
> So, the behavior depends on the size of the buffer -- and thus the
> size of the input lines.
>
> A bug indeed...

I don't understand.

aleph:~$ cat test
blah1
blah2
blah3
aleph:~$ tail -f test | awk '{print $1; exit 0}'
blah1
(hangs)

This is expected.  Awk printed one time and exited, per the given
script.  The output from tail/input from awk went all at once, awk
printed the first line, exited, and the rest of the input disappeared.
'tail' sent "blah1\nblah2\nblah3\n" to awk, awk printed until the
first newline and exited.

If I now write to test from another terminal:
aleph:~$ echo "blah4" >> test

Tail tries to write to the pipe, which it finds closed.  It receives a
SIGPIPE (tried to write to a pope with no reader--see man signal), and
it terminates.

The same behavior happens if I use a larger file.  I see no
inconsistent behavior, nor any bugs.

Erik

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to