Subject: bug#21265: tail -f: inotify being used on non-regular files

From: Stephane Chazelas <[email-masked]>
Date: Wed, 26 Aug 2015 12:19:59 +0100

2015-08-26 03:13:59 +0100, Pádraig Brady:
[...]
> I notice both with and without inotify
> there is a similar issue (for different reasons)
> when multiple devices are specified:
> 
>   tail ---dis -f /dev/tty /dev/tty
> 
> I.E. we generally can't deal with this case in either case,
> though it probably makes sense in any case to avoid inotify
> for device nodes?
> 
> BTW, in the inotify case, theoretically the kernel should be returning
> an error if the watch events are not supported?
> 
> The same argument applies that the kernel should return
> and error when adding a watch on pseudo file systems like /proc?
> To work around that, we'd have to get real kludgy and see
> were the files on a "dummy" file system or something.
> Though tail -f /proc files in either mode is not that useful,
> so probably not worrying about that case.
[...]

All very good points.

Many files in /proc, /sys... can only be read reliably in one read()
operation anyway, and doing tail -f on them would give you
garbage even if it worked.

I guess the best approach would be to only use inotify for
regular files, address blocking files (pipe, devices...) when
several files are being watched with poll() and/or non-blocking
IO, or alarm()/timers or threads, and document the other issues.

Or not do anything and just document those limitations as they
are mostly edge cases.

-- 
Stephane