Skip site navigation (1)Skip section navigation (2)
Date:      15 Jul 2003 07:02:32 -0000
From:      Colin Percival <cperciva@daemonology.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/54492: tail -F duplicates lines
Message-ID:  <20030715070232.26214.qmail@builder.daemonology.net>
Resent-Message-ID: <200307150710.h6F7AHYD067014@freefall.freebsd.org>

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


>Number:         54492
>Category:       bin
>Synopsis:       tail -F duplicates lines
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 15 00:10:17 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Colin Percival
>Release:        FreeBSD 4.7-SECURITY
>Organization:
>Environment:
>Description:
  tail -F sometimes duplicates lines after the first rotation.
>How-To-Repeat:

cperciva@beastie$ rm foo && touch foo && ( for x in 1 2 3 4 5; do echo 
hello $x > foo && sleep 2 && echo world $x >> foo;done & tail -F foo )
hello 1
world 1
hello 2
hello 2		# this line shouldn't be here
world 2
hello 3
hello 3		# this line shouldn't be here
world 3
hello 4
hello 4		# this line shouldn't be here
world 4
hello 5
hello 5		# this line shouldn't be here
world 5

  I've also observed this when using `tail -F` on Apache logfiles (again, 
after the file has been rotated once; when that happens, it prints out 
all the lines in the file again, as if the file had been rotated).

>Fix:

  Based on the symptoms, I'd say it looks like a bug in either the 
rotation-detection or the truncation-detection code; but I'm not familiar 
enough with kqueue to say any more than that.
>Release-Note:
>Audit-Trail:
>Unformatted:



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