While investigating why deleting a log file, then recreating and writing to it, tail would not ReOpen the log file.
As a test:
echo foo > test.log
tail -f test.log &
inotifywait -m test.log &
rm test.log (at this point, inotify issues an IN_ATTRIB on an open fd)
echo bar > test.log (tail does not reopen)
kill $(pidof tail) (now inotify will issue an IN_DELETE_SELF as the fd is closed and the inode is able to be purged from the filesystem)
The patch I'm submitting tests for this case and fallsthrough into the fsnotify.Remove code, which appears to handle it correctly.
Please look it over and let me know if this was the correct way to fix the problem.
While investigating why deleting a log file, then recreating and writing to it, tail would not ReOpen the log file.
As a test:
The patch I'm submitting tests for this case and fallsthrough into the fsnotify.Remove code, which appears to handle it correctly.
Please look it over and let me know if this was the correct way to fix the problem.
As an aside, I'm also using this patch: https://github.com/hpcloud/tail/pull/99 (Tailing stop bug fix)