mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
tail: ensure --follow=name unfollows renamed files
Require --retry to continue to track files upon rename. We already unfollowed a file if it was renamed to another file system (unlinked), so this makes the behavior consistent if renaming to a file in the same file system. I.e. --follow=name without --retry, means unfollow if the name is unlinked or moved, so this change ensures that behavior for all rename cases. Related commits: v8.0-121-g3b997a9bc, v8.23-161-gd313a0b24 * src/tail.c (tail_forever_notify): Remove watch for a renamed file if --retry is not specified. * tests/tail/F-vs-rename.sh: Related test cleanup. * tests/tail/follow-name.sh: Add a test case. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/74653
This commit is contained in:
1 parent
df71ac8343
commit
fd01fc8075
4 files changed
+22
-10
No files matched your search
+3
-2
@@ -1812,10 +1812,11 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
|
||||
if (ev->mask & (IN_ATTRIB | IN_DELETE | IN_DELETE_SELF | IN_MOVE_SELF))
|
||||
{
|
||||
/* Note for IN_MOVE_SELF (the file we're watching has
|
||||
been clobbered via a rename) we leave the watch
|
||||
been clobbered via a rename) without --retry we leave the watch
|
||||
in place since it may still be part of the set
|
||||
of watched names. */
|
||||
if (ev->mask & IN_DELETE_SELF)
|
||||
if (ev->mask & IN_DELETE_SELF
|
||||
|| (!reopen_inaccessible_files && (ev->mask & IN_MOVE_SELF)))
|
||||
{
|
||||
inotify_rm_watch (wd, fspec->wd);
|
||||
hash_remove (wd_to_name, fspec);
|
||||
|
||||
Reference in new issue
Block a user