GNU bug report logs - #23539
tail -f file name headings displayed too many times after suspend

Previous Next

Package: coreutils;

Reported by: Janne Snabb <snabb <at> epipe.com>

Date: Sat, 14 May 2016 22:16:02 UTC

Severity: normal

Tags: fixed

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Janne Snabb <snabb <at> epipe.com>, 23539 <at> debbugs.gnu.org
Subject: bug#23539: tail -f file name headings displayed too many times after suspend
Date: Mon, 6 Feb 2017 23:42:27 -0800
[Message part 1 (text/plain, inline)]
unarchive 23539
close 23539
stop

On 20/05/16 05:08, Pádraig Brady wrote:
> On 15/05/16 00:06, Janne Snabb wrote:
>> The attached patch fixes this bug for me.
>>
>> The patch moves the write_header() call in the inotify case to
>> dump_remainder() where write_header() is called only if some file
>> content is going to be output.
>>
>> I am not sure if this is the best approach. Another approach would be to
>> change the inotify event handling so that all queued events are read at
>> once and duplicates are eliminated before acting on them. Now it reads
>> and acts on them one.
> 
> I'd prefer to handle this much like you've done in the patch.
> I.E. avoid more complications with inotify.
> However consider the case where a file is truncated,
> with your patch subsequent writes will not get a header. I.E.
> 
>    echo file1 > file1
>    echo file2 > file2
>    tail -f file1 file2
> 
> Then in parallel:
> 
>    > file1
>    echo file1 > file1
> 
> You'll get output like:
> 
>    ==> file1 <==
>    file1
> 
>    ==> file2 <==
>    file2
>    tail: file1: file truncated
>    file1

The attached variant also handles the case above, and includes a test.
I'll push in your name tomorrow.

sorry for the delay on this.

Pádraig
[tail-suspend.patch (text/x-patch, attachment)]

This bug report was last modified 6 years and 265 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.