bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch to fix data loss with `tail -F' (bug 6612)


From: Jos Backus
Subject: Re: Patch to fix data loss with `tail -F' (bug 6612)
Date: Sun, 28 Sep 2008 19:44:19 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

        Hi Jim,

Thanks for your feedback so far.

You wrote:
>I think the trick to doing this right is as follows:
> 
>    When a tailed file (name) disappears, and a subsequent
>    open attempt shows the new file is nonexistent or empty,
>    continue tailing the old file descriptor.
>
>    Only once the new file has content do we perform the final read
>    and then close the old descriptor.

I think I'm close. The attached patch causes `tail -F' to handle the following
case:

    touch foo
    tail -F foo &
    mv foo bar
    date >> bar

The `date' output shows up in the tail output. Also, this change only stops
reading from the old file once the new file has some content. At that time the
old file is read until EOF and closed before starting on the new file.

What do you think?

-- 
Jos Backus
jos at catnook.com

Attachment: coreutils-6612.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]