Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jun 2003 15:09:09 -0400 (EDT)
From:      Hal Burch <hburch@lumeta.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/53288: tail will sometimes display more lines than it is told
Message-ID:  <20030613190909.1EDE35E3@hburch.corp.lumeta.com>
Resent-Message-ID: <200306131910.h5DJAFWO094396@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         53288
>Category:       bin
>Synopsis:       tail will sometimes display more lines than it is told
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 13 12:10:14 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Hal Burch
>Release:        FreeBSD 4.8-RC i386
>Organization:
Lumeta Comporation
>Environment:
System: FreeBSD hburch.corp.lumeta.com 4.8-RC FreeBSD 4.8-RC #1: Wed Mar 26 17:25:56 EST 2003 root@hburch.corp.lumeta.com:/usr/obj/usr/src/sys/LOCAL i386
>Description:
tail will sometimes output more lines than it is told if the file is
being appended to.  I believe this is occurs when data is written
to the file after tail computes where to start displaying data,
but before the display starts.
>How-To-Repeat:
Run one program that continuously prints out lines to a file:
	while [ 1 ]; do echo test; done > file
While that is running, run a bunch of tails and compute their length
	for i in `seq 1 1000`; do tail file | wc -l | done > linecnt
(In case it's not clear from the name, seq prints out 1 through 1000)
Look at the distribution of the line counts that were displayed:
 	sort -n linecnt | uniq -c

On my run:
 975       10
   1       61
   1       68
   1      118
   1      131
   1      134
   2      138
   1      168
   2      170
   1      174
   1      205
   1      227
   1      235
   1      259
   1      291
   1      348
   1      362
   1      367
   1      797
   1     1170
   1     1562
   1     2198
   1     5738
   1     5861
>Fix:
No known fix.  tail could declare the end of the file (when -f is not
done) to be the length of the file when it first touches it, but that
could cause additional problems.
>Release-Note:
>Audit-Trail:
>Unformatted:



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