Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Aug 2010 12:49:32 -0500 (CDT)
From:      "Sean C. Farley" <scf@FreeBSD.org>
To:        Gabor Kovesdan <gabor@FreeBSD.org>
Cc:        current@FreeBSD.org
Subject:   Re: bsdgrep does not work with tail -f | grep combination
Message-ID:  <alpine.BSF.2.00.1008041220140.6502@thor.farley.org>
In-Reply-To: <4C585E44.5030608@FreeBSD.org>
References:  <86eiefhalp.wl%poyopoyo@puripuri.plala.or.jp> <4C585E44.5030608@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 3 Aug 2010, Gabor Kovesdan wrote:

> Em 2010.08.03. 19:25, poyopoyo@puripuri.plala.or.jp escreveu:
>> Hi,
>> 
>> It seems bsdgrep does not work when piped from tail -f.
>> I'm running r210728.
>> 
>> term0$ jot 10>  /tmp/1
>> term0$ tail -f /tmp/1 | grep 0
>> [no output]
>> 
>> otherterm$ jot 10>>  /tmp/1
>> [no output to term0]
>> 
>> =====
>> 
>> with GNU grep:
>> 
>> term0$ tail -f /tmp/1 | gnugrep 0
>> 10
>> otherterm$ jot 10>>  /tmp/1
>> [on term0]
>> 10
>> 10
>> 
> I've checked on 8.0 and GNU grep doesn't output anything either for me. If 
> you use tail -f, you will enter more lines and end it with EOF, won't you? 
> And then BSD grep will process the input and print out matches. I don't think 
> it's bad behaviour in itself but if you can explain why you think it's bad 
> I'm willing to change it.

On 8.1, GNU grep (from system) and FreeGrep (personal repo with my 
fastcomp changes) both output the '10' from this test.  Are you sure you 
ran GNU grep on that system and did not accidentally run a copy of BSD 
grep?

With bsdgrep in HEAD, I think it is not processing the input until 
stdio's buffer is flushed at the 8KB mark.  I barely looked at the code, 
so I am merely surmising.

Sean
-- 
scf@FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1008041220140.6502>