Hello,

it seems on Linux, GNU tail -f uses inotify to check if data is
available even for those types of files where inotify doesn't
work.

For instance, when running:

tail -fn+1 /dev/tty

Then press 1<Return><Ctrl-D>2<Return><Ctrl-D>3<Return>4<Return>

$ tail -fn+1 /dev/tty
1
1
^D2
2
^D3
4

upon the first <Ctrl-D> tail installs an inotify watcher on
/dev/tty and tries another read loop. But upon the second
<Ctrl-D>, it waits on the inotify watch which will never return
because inotify doesn't work on device files. So while 1 and 2
are being displayed, 3 and 4 and anything afterwards are not.

That shouldn't be too big of a problem because it's unlikely one
would use tail -f on a device and not many devices may return
multiple eofs like tty devices do. AFAIK, pipes and sockets
can't return more than one eof.

But I suppose if one ever wants to use tail -f on non-regular
files, that would be for some that do exhibit a multiple-eof
behaviour.

Work around for now is the undocumented ---disable-inotify
option.

-- 
Stephane



Reply via email to