Discussion:
bug#9266: tail -F does not follow through symlinks
(too old to reply)
Bart Vanhaute
2011-08-09 08:14:40 UTC
Permalink
When I use tail -F to follow a file that is a symlink to another file,
and that second file gets replaced, tail no longer follows the new
file. I am not sure if this scenario is actually supported, but the
current behaviour is unexpected to me.

Detailed scenario to reproduce:

in one terminal:
$ ln -s f a
$ touch f
$ tail -F a

in another terminal:
$ mv f f.0
$ echo 'hello' > f

The output in terminal one will show
tail: `a' has become inaccessible: No such file or directory
but it will not show the 'hello' message.

I am using coreutils version 8.5 on debian sid (linux kernel version
3.0.0), but I noticed the same behaviour in coreutils version 8.9 on
opensuse (linux kernel version 2.6.37).

greetings,
Bart.
Jim Meyering
2011-08-09 16:28:30 UTC
Permalink
Post by Bart Vanhaute
When I use tail -F to follow a file that is a symlink to another file,
and that second file gets replaced, tail no longer follows the new
file. I am not sure if this scenario is actually supported, but the
current behaviour is unexpected to me.
$ ln -s f a
$ touch f
$ tail -F a
$ mv f f.0
$ echo 'hello' > f
The output in terminal one will show
tail: `a' has become inaccessible: No such file or directory
but it will not show the 'hello' message.
I am using coreutils version 8.5 on debian sid (linux kernel version
3.0.0), but I noticed the same behaviour in coreutils version 8.9 on
opensuse (linux kernel version 2.6.37).
Thank you for the report.
That is indeed a difference in behavior from
the way tail works without inotify support.

If you want the old behavior (though there is no guarantee this
option will be around forever -- it's deliberately not documented),
use tail's ---disable-inotify option. Note the three leading '-'s.

Another work-around is to use readlink to give tail
an absolute name for the file:

tail -F "$(readlink -e a)"

Regarding tail's behavior change, we'll have to investigate
if/how to address it.
Assaf Gordon
2018-10-30 08:50:52 UTC
Permalink
tags 9266 notabug
close 9266
stop

(triaging old bugs)
Post by Jim Meyering
Post by Bart Vanhaute
When I use tail -F to follow a file that is a symlink to another file,
and that second file gets replaced, tail no longer follows the new
file. I am not sure if this scenario is actually supported, but the
current behaviour is unexpected to me.
Thank you for the report.
That is indeed a difference in behavior from
the way tail works without inotify support.
If you want the old behavior (though there is no guarantee this
option will be around forever -- it's deliberately not documented),
use tail's ---disable-inotify option. Note the three leading '-'s.
with no further comments in 7 years, I'm closing this bug.

-assaf

Loading...