[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21265: tail -f: inotify being used on non-regular files
From: |
Stephane Chazelas |
Subject: |
bug#21265: tail -f: inotify being used on non-regular files |
Date: |
Sat, 15 Aug 2015 13:35:48 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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
- bug#21265: tail -f: inotify being used on non-regular files,
Stephane Chazelas <=