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

Bug#70762: textutils: tail segfault



On Sat, Nov 16, 2002 at 08:58:48AM +1100, Herbert Xu wrote:
> On Fri, Nov 15, 2002 at 01:22:44PM -0800, Jeff Bailey wrote:
> > On Sat, Nov 16, 2002 at 08:10:22AM +1100, Herbert Xu wrote:
> > 
> > > > Sure, but it would also be reasonable to flush the buffer to the screen
> > > > every (screensize/2) so that a human could follow it.
> > 
> > > Tail can't do that until it finds the new lines...
> > 
> > s/can't/doesn't/ ? Sounds like an upstream bug...
> 
> Huh? tail is meant to show you the last ten lines.  Until you've read
> all the output, how are you meant to know whether they're the last ten?
[snip]

Perhaps if lines are too long, tail should either keep the file offsets of
the last N lines instead of buffering them, and fseek() back later once it
knows where EOF is. If it's a non-seekable stream, perhaps it should
resort to on-disk storage (like 'less').

OTOH, this still won't work with /dev/zero since it is infinite--tail
would just eat up disk space instead of just memory. This seems to me to
be a pathological case. What is the "correct" behaviour of tail on
infinite streams? There is no way, aside from special knowledge/hard
coding, to know if a line is infinite or not, because to halt in finite
time would be imposing an arbitary limit on line length.

I guess the question is, at what point do we say, this is enough for
practical purposes, we'll stop here? Or is it "OK" to let tail consume
resources until it eats up everything and dies?


T

-- 
Nothing in the world is more distasteful to a man than to take the path that
leads to himself. -- Herman Hesse



Reply to: