Commit Graph

54 Commits

Author SHA1 Message Date
Lucas Kacher 000912af8d fix fsnotify relocation
* http://gopkg.in/fsnotify/fsnotify.v1 is the new location
* see: https://github.com/go-fsnotify/fsnotify
2018-03-21 11:19:57 -04:00
Nino Kodabande 854fb55510 Resolves merge conflict in inotify 2017-07-07 12:41:52 -07:00
Vlad Losev 2e79377851
Restores error propagation from fsnotify.Watcher.Add. 2017-03-20 18:08:26 -07:00
Vlad Losev 669c44045e
Fixes leak of watch counters in InotifyTracker.remove. 2017-03-20 17:50:07 -07:00
Vlad Losev b0c08f2030
Fixes log reopening. 2017-03-18 14:25:17 -07:00
xuzixx 89ee1afdf5 Issue 111: TestReSeekInotify failed
if "case fsnotify.Chmod" logic before "case fsnotify.Rename"
always `return changes.NotifyDeleted()`

Test case pass:
macOs 10.11.6 + go 1.6.2
Centos 6.4 + go 1.8
2017-03-05 18:55:54 +08:00
Nino Kodabande 33107f39d5 Merge pull request #100 from bahlo/cleanup-error
Return error on tail.Cleanup
2017-02-06 18:32:04 -08:00
Nino Kodabande 46ed7f0315 Merge pull request #99 from arunmathew88/TailingStopBugFix
Tailing stop bug fix
2017-02-06 18:12:11 -08:00
TerraTech bf39eb4f51 inotify.go: Fix bug where inotify returns IN_ATTRIB against an open fd 2016-09-09 01:07:24 -07:00
Arne Bahlo 9c97d7511f Return error on tail.Cleanup 2016-09-02 22:15:29 +02:00
Arun Mathew 48cd00098f Issue 97 Fixing deferred RemoveWatch() due to which tailing stops (gets stuck) in certain conditions 2016-08-01 15:58:52 +09:00
Arun Mathew 3ca1edc9ed Issue 98 Buffered channels to avoid lost NotifyDeleted()/NotifyTruncated()/NotifyModified() signals 2016-08-01 15:58:21 +09:00
Nino Khodabandeh 34db8a6edf Updates licensing and all the header comments 2016-04-26 15:47:46 -07:00
Benoit Sigoure 5e2d004af5 watch: Fix prototype to be more restrictive.
Change-Id: Ic744312efa91cf5c2dc2810e597353a080dccb70
2016-04-08 16:29:40 -07:00
Benoit Sigoure ac5972aca8 watch: Unsubscribe from fsnotify synchronously.
Calling watcher.Remove() from the run() goroutine is now problematic,
because with the change made in fsnotify/fsnotify#73 Remove() can now
take an arbitrary amount of time, which means we can deadlock if run()
is waiting for fsnotify to acknowledge the removal and fsnotify is
trying to send an unrelated Event.

So instead we now do part of the cleanup, including calling Remove(),
synchronously, in the goroutine trying to unsubscribe.

This fixes #75.  Thanks to Aaron Beitch for the fix.

Change-Id: I346c9eecc34b2378312b07b3c3efc41616b95380
2016-04-08 16:29:40 -07:00
Nino Khodabandeh 0ea51b0fd6 Changes the path clean to absolute path 2016-04-04 15:51:37 -07:00
Nino Khodabandeh 468784e1d4 Merge branch 'stop-at-eof' of https://github.com/flynn/tail into flynn-stop-at-eof 2016-04-04 12:56:46 -07:00
miraclesu 274567a526 fix data race 2015-12-24 16:47:46 +08:00
miraclesu 6aef373ea6 fix block until exists function 2015-12-09 15:29:06 +08:00
Benoit Sigoure f69ef84e36 Fix race in the detection of truncation.
Before going into ChangeEvents(), the code was calling stat on the file
to know where it was at, which is incorrect as stat could return the new
file size post truncation.  Instead we now ask the file descriptor about
our current offset, so we can compare our offset to the file size to try
to detect truncation.

Truncation detection remains brittle, but this closes an annoying race
we frequently run into.
2015-10-27 22:42:26 -07:00
Alex Liu abb1479f04 Remove pointer from fsnotify.Event 2015-10-27 22:42:26 -07:00
Alex Liu 8b4773e24e Upgrade to fsnotify.v1 2015-10-27 22:42:25 -07:00
Andy Ouyang d46611791d Moved InotifyTracker initialization to constructor function 2015-10-27 22:42:25 -07:00
Andy Ouyang a5dc0d39ba Ensure InotifyTracker attempts to send all FileEvents 2015-10-27 22:42:25 -07:00
Andy Ouyang f053e2cd0c Fixed race conditions in watch/inotify_tracker.go 2015-10-27 22:42:25 -07:00
Andy Ouyang 0b9f044bb3 Ignoring EINTR (ctrl+Z) signal 2015-10-27 22:42:25 -07:00
Andy Ouyang b155fc13d4 Single shared Watcher used to avoid inotify limit 2015-10-27 22:42:07 -07:00
Nino Khodabandeh 05d326f717 Merge pull request #62 from florindragos/master
Treat permission error as if file was deleted on windows
2015-09-30 10:56:01 -07:00
Nino Khodabandeh 9ca2efc54b Merge pull request #32 from 0x001D/master
detect file size modification for polling
2015-09-30 10:46:22 -07:00
Florin Dragos 2403cad5eb Fix imports 2015-09-30 17:50:49 +03:00
Florin Dragos d9f4dcdb25 Treat permission error as if file was deleted on windows 2015-09-29 17:32:21 +03:00
Joel Reymont 48bc495430 minor 2015-07-03 16:53:13 +02:00
Joel Reymont 035761b7bc one watcher 2015-07-03 16:35:40 +02:00
Sridhar Ratnakumar 15e71d383e Use stable version of fsnotify
fixes #46
2015-06-28 20:23:06 -07:00
Jonathan Rudenberg 0587510d19 Remove Close method from FileChanges
This method will never do what we want, closing the channels will always
signal receivers, which will confuse them.
2014-12-25 21:02:30 -05:00
Konstantinos Koukopoulos d20f005e95 support freebsd, like darwin 2014-10-08 12:37:29 +03:00
Rickard von Essen ed4080883b [GH-37] Support Darwin (OS X) again 2014-07-29 00:29:01 +02:00
florindragos c2a48be739 add FILE_SHARE_DELETE flag when opening file 2014-07-28 16:38:02 +03:00
Sridhar Ratnakumar 22e519566e Fix tomb import
has moved from launchpad.net (now down) to GitHub, and accessible as
gopkg.in/tomb.v1

closes #33
2014-06-14 23:39:34 -07:00
0x001D 604d99043e detect file size modification for polling
polling did not work (at least for a win32 environment)
2014-06-12 00:22:14 +02:00
Sridhar Ratnakumar baf6674f00 add copyright statements 2014-04-12 16:59:40 -07:00
Sridhar Ratnakumar 6ffcd854c1 run 'go fmt' (and fix 'make fmt' in Makefile) 2013-11-13 17:38:23 -08:00
Sridhar Ratnakumar 323e1c0988 add Cleanup function to close open inotify watches
bug: 101635
2013-11-12 20:15:27 -08:00
Sridhar Ratnakumar 56c4b221b8 replace the alarmist panic with Fatal
Fatal shows only a single goroutine stacktrace.
2013-10-11 18:19:43 -07:00
Sridhar Ratnakumar 88298d7cf8 Merge pull request #18 from miraclesu/fix_stop_hang
Fix a hang in `Stop` when tailing a non-existent file

Reproducible on linux, but not on mac.
2013-09-23 18:19:18 -07:00
miraclesu a7f9b4b6fc Fixed stop hang & stop err 2013-09-23 15:03:51 +08:00
presbrey afd80c034c fix race/panic on modify+delete
This fixes a race condition when a file is modified and unlinked in the OS before the inotify IsModify event has a chance to call os.Stat.
2013-09-22 22:51:12 -04:00
Sridhar Ratnakumar 92ad722d56 update readme, comments; gofmt 2013-05-29 16:32:01 -07:00
Sridhar Ratnakumar 68dffd22b4 fix a regression with truncation detection 2013-05-29 15:08:24 -07:00
Sridhar Ratnakumar 499e541b19 copytruncate should work even if ReOpen is False.
at least, `tail -f` (not `tail -F` which is analogous to ReOpen)
reopens truncated files.

this change introduces the FileChanges struct to abstract the change
notifications for file changes, deletions and truncations.
2013-05-29 14:32:59 -07:00