From cperciva@builder.daemonology.net  Tue Jul 15 00:02:41 2003
Return-Path: <cperciva@builder.daemonology.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 01A8637B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 15 Jul 2003 00:02:41 -0700 (PDT)
Received: from builder.daemonology.net (h24-87-233-42.vc.shawcable.net [24.87.233.42])
	by mx1.FreeBSD.org (Postfix) with SMTP id 1949E43FBD
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 15 Jul 2003 00:02:40 -0700 (PDT)
	(envelope-from cperciva@builder.daemonology.net)
Received: (qmail 26216 invoked by uid 1000); 15 Jul 2003 07:02:32 -0000
Received: (for user cperciva)
Message-Id: <20030715070232.26214.qmail@builder.daemonology.net>
Date: 15 Jul 2003 07:02:32 -0000
From: Colin Percival <cperciva@daemonology.net>
Reply-To: Colin Percival <cperciva@daemonology.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: tail -F duplicates lines
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         54492
>Category:       bin
>Synopsis:       tail -F duplicates lines
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 15 00:10:17 PDT 2003
>Closed-Date:    Sat Sep 13 23:24:20 PDT 2003
>Last-Modified:  Sat Sep 13 23:30:21 PDT 2003
>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:

From: Colin Percival <colin.percival@wadham.ox.ac.uk>
To: freebsd-gnats-submit@FreeBSD.org, cperciva@daemonology.net
Cc: dg@freebsd.org
Subject: Re: bin/54492: tail -F duplicates lines
Date: Sat, 13 Sep 2003 20:00:18 -0700

    It looks like this PR (bin/54492) was fixed by dg in version 1.33 of
 usr.bin/tail/forward.c; could someone please close it?
 
 Colin Percival
 
State-Changed-From-To: open->closed 
State-Changed-By: dg 
State-Changed-When: Sat Sep 13 23:22:29 PDT 2003 
State-Changed-Why:  
Fixed in rev 1.33 of tail/forward.c and merged to -stable.  

http://www.freebsd.org/cgi/query-pr.cgi?pr=54492 

From: "David G. Lawrence" <dg@dglawrence.com>
To: Colin Percival <colin.percival@wadham.ox.ac.uk>
Cc: freebsd-gnats-submit@FreeBSD.org, cperciva@daemonology.net
Subject: Re: bin/54492: tail -F duplicates lines
Date: Sat, 13 Sep 2003 23:27:31 -0700

 >   It looks like this PR (bin/54492) was fixed by dg in version 1.33 of
 > usr.bin/tail/forward.c; could someone please close it?
 
    Done. Thanks for the note.
 
 -DG
 
 David G. Lawrence
 Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500
 TeraSolutions, Inc. - http://www.terasolutions.com - (888) 346 7175
 The FreeBSD Project - http://www.freebsd.org
 Pave the road of life with opportunities.
>Unformatted:
