[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23539: tail -f file name headings displayed too many times after sus
From: |
Pádraig Brady |
Subject: |
bug#23539: tail -f file name headings displayed too many times after suspend |
Date: |
Fri, 20 May 2016 13:08:12 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
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
I suppose you could track the header_outputted state in each File_spec?
thanks!
Pádraig