coreutils
[Top][All Lists]
Advanced

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

Re: tail --retry not re-attempting to open file


From: Bernhard Voelker
Subject: Re: tail --retry not re-attempting to open file
Date: Thu, 04 Apr 2013 00:46:49 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4

Hi Padraig,

On 04/03/2013 01:02 PM, Pádraig Brady wrote:
> Yes I agree that this is a regression associated with the inotify support.
> I take `tail --follow=descriptor --retry` to mean,
> Wait for the file to appear initially and follow even if renamed or unlinked.

The problem is that tail_forever_inotify() returns false when the
initial open in tail_file() failed. This makes tail exit immediately.
Without intense reading of the source, I guess it's not easy to
use inotify in such a case. Therefore, falling back to polling
seems to be quite okay.
The attached patch implement this in a one-liner:

@ -2189,7 +2192,8 @@ main (int argc, char **argv)
          is recreated, then we don't recheck any new file when
          follow_mode == Follow_name  */
       if (!disable_inotify && (tailable_stdin (F, n_files)
-                               || any_remote_file (F, n_files)))
+                               || any_remote_file (F, n_files)
+                               || !ok))
         disable_inotify = true;

       if (!disable_inotify)

>> Furthermore, I find this warning irritating
>>   "warning: --retry is useful mainly when following by name"
> 
> I agree. It's not imparting much info, about why that's supported.
> What we should do is print what tail will do in this case.
> I propose we do:
> 
> if (retry)
>   if (!follow_mode)
>     warn ("--retry ignored");
>   else if (follow_mode == DESC)
>     warn ("--retry only effective for the initial open");

I'd go even one step further, and also remove the latter warning.
It fits better into the texinfo documentation.
The attached patch includes that, too.

Finally, the patch comes with a new test, NEWS etc.

WDYT?

Have a nice day,
Berny

Attachment: tail-f-retry.patch
Description: Text Data


reply via email to

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