Re: tail does not exit

2007-12-20 Thread Chuck Swiger
On Dec 20, 2007, at 1:58 AM, Mikhail Teterin wrote: On середа 19 грудень 2007, Chuck Swiger wrote: = A quick test suggests that "tail -f" will close when it gets a SIGPIPE. SIGPIPE? How is that relevant? Does tail get a SIGPIPE, when awk disappears in my example? If it does not, why do you

Re: tail does not exit

2007-12-20 Thread Mikhail Teterin
четвер 20 грудень 2007 11:58 до, Erik Osterholm Ви написали: > Ah, I see.  With very, very long lines, tail doesn't send the output > all at once. The cutoff seems to be 65536 bytes on my system. They don't even have to be very very long -- unless in an artificial example, such as the one I poste

Re: tail does not exit

2007-12-20 Thread Erik Osterholm
On Thu, Dec 20, 2007 at 11:02:59AM -0500, Mikhail Teterin wrote: > On ?? 20 ??? 2007, Erik Osterholm wrote: > = The same behavior happens if I use a larger file.  I see no > = inconsistent behavior, nor any bugs. > > The inconsistency is in the fact, that the behavior depends on the size o

Re: tail does not exit

2007-12-20 Thread Erik Osterholm
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 > si

Re: tail does not exit

2007-12-20 Thread Mikhail Teterin
On четвер 20 грудень 2007, Erik Osterholm wrote: = The same behavior happens if I use a larger file.  I see no = inconsistent behavior, nor any bugs. The inconsistency is in the fact, that the behavior depends on the size of the buffer and length of the lines (not the size of the file). If the 1

Re: tail does not exit

2007-12-20 Thread Mikhail Teterin
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... -mi

Re: tail does not exit

2007-12-20 Thread Max N. Boyarov
> "MT" == Mikhail Teterin writes: MT> On четвер 20 грудень 2007, Max N. Boyarov wrote: MT> = after something writeln to /var/log/messages tail get SIGPIPE MT> But why is that needed for tail to notice? It is trying to output 10 lines. MT> After it outputs the very first one of them, aw

Re: tail does not exit

2007-12-20 Thread Mikhail Teterin
On четвер 20 грудень 2007, Max N. Boyarov wrote: = after something writeln to /var/log/messages tail get SIGPIPE But why is that needed for tail to notice? It is trying to output 10 lines. After it outputs the very first one of them, awk exits, and the 9 subsequent lines go into thin air /withou

Re: tail does not exit

2007-12-20 Thread Max N. Boyarov
> "MT" == Mikhail Teterin writes: [...] MT> I'm sorry, this does not make sense to me. Starting with an empty MT> file, as you do in 1), /may/ make tail not notice, that awk went MT> away, because tail has nothing to write to stdout. MT> But /var/log/messages is not empty, and awk -

Re: tail does not exit

2007-12-20 Thread Mikhail Teterin
On середа 19 грудень 2007, Chuck Swiger wrote: = A quick test suggests that "tail -f" will close when it gets a SIGPIPE. SIGPIPE? How is that relevant? Does tail get a SIGPIPE, when awk disappears in my example? If it does not, why do you bring it up? And if it does get SIGPIPE, then you are wron

Re: tail does not exit

2007-12-19 Thread Chuck Swiger
On Dec 19, 2007, at 4:06 PM, Mikhail Teterin wrote: Josh Tolbert: Cause the -f option to tail doesn't work that way. -f always waits for more input. I know very well about -f waiting for more *input*. What puzzles me, is that tail does not quit, when its *output* is closed. James Harriso

Re: tail does not exit

2007-12-19 Thread Max N. Boyarov
> "MT" == Mikhail Teterin writes: MT> Max N. Boyarov: >>       -f      The -f option causes tail to not stop when end of file is >>              reached, but rather to wait for additional data to be appended >> to the input.  The -f option is ignored if the standard input is a pipe, >>

Re: tail does not exit

2007-12-19 Thread Mikhail Teterin
Max N. Boyarov: >       -f      The -f option causes tail to not stop when end of file is >              reached, but rather to wait for additional data to be appended > to the input.  The -f option is ignored if the standard input is a pipe, > but not if it is a FIFO. Josh Tolbert: > Cause the -f

Re: tail does not exit

2007-12-19 Thread Max N. Boyarov
> "MT" == Mikhail T. writes: MT> Why does not the script below actually ever exit? MT> #!/bin/sh MT> if tail -f /var/log/messages | awk '{print "Exiting"; exit 0}' MT> then MT> echo Exited MT> else MT> echo Failed MT>

Re: tail does not exit

2007-12-19 Thread Robert Huff
James Harrison writes: > tail -f holds on for dear life until a ctrl-c happens. IT HAS A > DEATH GRIP! Agreed. Robert Huff ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listin

Re: tail does not exit

2007-12-19 Thread James Harrison
On Wed, 2007-12-19 at 18:22 -0500, Mikhail T. wrote: > #!/bin/sh > > if tail -f /var/log/messages | awk '{print "Exiting"; exit 0}' > then > echo Exited > else > echo Failed > fi > > exit 0 I assume it has something