Subject: bug#74653: tail --follow=name doesn't exit when using inotify and the file is moved

From: Göran Uddeborg <[email-masked]>
Date: Mon, 2 Dec 2024 17:19:21 +0100

When using "tail --follow=name", but without "--retry", on a file
supporting inotify, the command doesn't finish if the file is moved to
a new name.

Repeat this way on a local filesystem:

    echo apa > apa
    tail --follow=name apa &
    mv apa bepa

"tail" will print an error message saying "No such file or directory",
but it will continue running. I would expect a following message "no
files remaining" and "tail" to exit.

If the file system doesn't support inotify, if "apa" is on NFS for
example, "tail" exits as expected.

If the file is removed rather than moved ("rm apa") "tail" also exits
as expected.

This is tested on Fedora 41 using

coreutils-9.5-11.fc41.x86_64
kernel-6.11.6-300.fc41.x86_64