For the record, I noticed another edge case with tail's
inotify implementation, documented in the attached patch.

Due to not distinguishing hardlinks, followed data for
only one of the hardlinked names is output.

$ echo 1 >file
$ ln file fileln


======== Inotify case ==============
$ tail -F file fileln
==> file <==
1

==> fileln <==
1
2 <-------------------------------- echo 2 > file




======== Non inotify case ==============
$ tail -F ---dis file fileln
==> file <==
1
2

==> fileln <==
1
2
  <-------------------------------- echo 3 > file
==> file <==
3

==> fileln <==
3



cheers,
Pádraig.
From 8e31dc2fdde082f57ddb464b791491231d21b8ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Thu, 5 Feb 2015 13:59:12 +0000
Subject: [PATCH] maint: document a caveat in the tail inotify implementation

* src/tail.c (main): Document another caveat with the
inotify implementation wrt multiple hardlinked files.
---
 src/tail.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/tail.c b/src/tail.c
index b512c2a..27aea6b 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -2240,7 +2240,11 @@ main (int argc, char **argv)
 
          FIXME: when using inotify, and a directory for a watched file
          is recreated, then we don't recheck any new file when
-         follow_mode == Follow_name  */
+         follow_mode == Follow_name.
+
+         FIXME-maybe: inotify has a watch descriptor per inode, and hence with
+         our current hash implementation will only --follow data for one
+         of the names when multiple hardlinked files are specified.  */
       if (!disable_inotify && (tailable_stdin (F, n_files)
                                || any_remote_file (F, n_files)
                                || any_symlinks (F, n_files)
-- 
2.1.0

Reply via email to