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: Tue, 30 Sep 2008 09:36:35 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

    Hi Jim,

On Tue, Sep 30, 2008 at 10:37:54AM +0200, Jim Meyering wrote:
> Jos Backus <address@hidden> wrote:
> > On Mon, Sep 29, 2008 at 10:37:31AM +0200, Andreas Schwab wrote:
> >> Jos Backus <address@hidden> writes:
> >>
> >> > 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 if the old file keeps growing?
> >
> > "Too bad." With proper log rotation this never happens anyway.

What is tail supposed to do? It's now seen a new file named foo (after foo was
renamed to bar). Why would it care about bar, even though bar may continue to
grow? It's supposed to tail foo, not bar. As a courtesy, until a new foo shows
up, it will now tail bar because it solves the log rotation problem. Isn't
that what you requested? E.g.

    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.

> > Perhaps this solution isn't perfect, but as it stands today `tail -F' is
> > broken for tailing logfiles in that it _will_ lose data when the file is
> > rotated. My test setup proves this. So something _has_ to be done.
> 
> Hi Jos,
> 
> Thanks for working on this.
> However, if there's a motto in coreutils development, "do it right"
> comes close, which you can interpret as making the code correct
> (of course), robust, maintainable, portable and efficient.
> We try not to compromise on any of those.
 
Agreed. But as it stands today, `tail -F' is _not_ correct in the face of
rotating log files. The initial patch fixes this without changing the behavior
too much. I realize there are still more bugs, but not solving all of them
shouldn't prevent us from solving some of them.

> So, it'd be nice to solve this problem while also remaining faithful
> to the documentation, which implies that with --follow=name, tail will
> indeed detect the renaming, even if the original continues to grow.

Isn't that what happens already? I'm confused.

Thanks for your help resolving this problem.

-- 
Jos Backus
jos at catnook.com




reply via email to

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