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


Message #11 received at 23539 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Janne Snabb <snabb <at> epipe.com>, 23539 <at> debbugs.gnu.org
Subject: Re: bug#23539: tail -f file name headings displayed too many times
 after suspend
Date: Fri, 20 May 2016 13:08:12 +0100
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




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.