bin/54492: tail -F duplicates lines

Colin Percival cperciva at daemonology.net
Tue Jul 15 00:10:19 PDT 2003


>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 at 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:


More information about the freebsd-bugs mailing list