bin/53288: tail will sometimes display more lines than it is told
Hal Burch
hburch at lumeta.com
Fri Jun 13 12:10:17 PDT 2003
>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 at 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:
More information about the freebsd-bugs
mailing list