]> go.fuhry.dev Git - fsnotify.git/log
fsnotify.git
3 years agoDocument that /proc and /sys won't work
Martin Tournoij [Sat, 30 Jul 2022 12:31:21 +0000 (14:31 +0200)]
Document that /proc and /sys won't work

Fixes #78

3 years agoClarify FAQ on goroutines
Martin Tournoij [Sat, 30 Jul 2022 11:15:01 +0000 (13:15 +0200)]
Clarify FAQ on goroutines

Fixes #71

3 years agomacos: retry if open() returns EINTR (#475)
Martin Tournoij [Sat, 30 Jul 2022 10:54:27 +0000 (12:54 +0200)]
macos: retry if open() returns EINTR (#475)

Retry the unix.Open() if the error returned is EINTR; looking around the
web it seems many systems handle it like this. This is also what
os.Open() does:
https://github.com/golang/go/commit/50d0ee0c98ea21f818d2daa9bc21ef51861a2ef9

Fixes #354

3 years agoFix lint (#476)
Martin Tournoij [Sat, 30 Jul 2022 10:53:47 +0000 (12:53 +0200)]
Fix lint (#476)

Didn't run for some reasons; something with the actions cache:

/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/b9a1abd7-273e-449f-b255-5e8e947b3f97/cache.tzst -P -C /home/runner/work/fsnotify/fsnotify
Error: /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20220412211240-33da011f77ad/windows/race0.go: Cannot open: File exists
Error: /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20220412211240-33da011f77ad/windows/types_windows.go: Cannot open: File exists

Replace it with staticcheck; which is nicer anyway.

3 years agodebian 6 test: deal with multiple packages (#474)
Martin Tournoij [Fri, 29 Jul 2022 23:33:19 +0000 (01:33 +0200)]
debian 6 test: deal with multiple packages (#474)

* debian 6 test: deal with multiple packages

The ./cmd/fsnotify doesn't have any tests, but sooner or later we'll
have subpackages so deal with it properly now.

* Cache vagrant boxes

3 years agoRemove AUTHORS file
Martin Tournoij [Fri, 29 Jul 2022 21:00:44 +0000 (23:00 +0200)]
Remove AUTHORS file

This goes back to when this library was part of golang.org/x/...; the "Google lawyers" said that an AUTHORS file was needed, but seems they changed their minds and it got removed from Go last week and decided that the git log is enough:
https://github.com/golang/go/commit/774fa58d1d3c9926709e108afdf83af7010bde72

I don't think there's much value keeping it here, and it's one more thing that can be forgotten (it's already out of date). The authorship is preserved in the git log, and if that's good enough for Google's lawyers then it's good enough for me.

3 years agoUpdate README: split out FAQ to "Platform-specific notes"
Martin Tournoij [Fri, 29 Jul 2022 20:15:40 +0000 (22:15 +0200)]
Update README: split out FAQ to "Platform-specific notes"

It's a bit clearer to document it like this.

Also some other minor changes to the README.

Fixes #457

3 years agoinotify: don't ignore events for files that don't exist (#470)
Martin Tournoij [Fri, 29 Jul 2022 18:31:09 +0000 (20:31 +0200)]
inotify: don't ignore events for files that don't exist (#470)

This is quite an odd check, leading to an inconsistent event stream,
which also doesn't match what other platforms do. If you do a "CREATE +
MODIFY + REMOVE" in quick succession then you probably *want* all three
events. If you don't want to operate on non-existing files, then you can
check this in your application code.

You need to do that already, since this check is far from reliable. In
the time between this check and the application code doing something
with an event the file may have been deleted already.

I looked a bit at the history of this, and looks like it was added in
2013 with cc2c34e; issue 36 refers to this issue on the old repo, which
mentions it fixes a memory leak: https://github.com/howeyc/fsnotify/issues/36

I can't reproduce that at all; using the CLI from #463 modified to print
the memory and running:

for i in $(seq 0 10000); { touch $i; rm $i }

Memory stays at about 100/110K in both the current main branch and this.

So I think it should be safe to remove.

3 years agoTweak comment regarding relative paths (#466)
Martin Tournoij [Fri, 29 Jul 2022 18:29:25 +0000 (20:29 +0200)]
Tweak comment regarding relative paths (#466)

Clarify what "relative" means here.

Fixes #362

3 years agoAdd cmd/fsnotify (#463)
Martin Tournoij [Fri, 29 Jul 2022 18:28:45 +0000 (20:28 +0200)]
Add cmd/fsnotify (#463)

This adds a little example that can be run:

% go run ./cmd/fsnotify **/*
12:76:11.4710 watching; press ^C to exit
12:76:13.6549   1 REMOVE                "cmd/fsnotify/4913"
12:76:13.6550   2 RENAME                "cmd/fsnotify/main.go"
12:76:13.6550   3 RENAME                "cmd/fsnotify/main.go"
12:76:13.6612   4 CREATE                "cmd/fsnotify/main.go"
12:76:13.6612   5 WRITE      (modified) "cmd/fsnotify/main.go"
12:76:13.6614   6 WRITE      (modified) "cmd/fsnotify/main.go"
12:76:13.6648   7 CHMOD                 "cmd/fsnotify/main.go"
12:76:15.2919   8 CREATE                "cmd/fsnotify/4913"
12:76:15.2919   9 REMOVE                "cmd/fsnotify/4913"
12:76:15.2922  10 CHMOD                 "cmd/fsnotify/main.go"
12:76:15.2923  11 REMOVE                "cmd/fsnotify/main.go"
12:76:15.2925  12 RENAME                "cmd/fsnotify/main.go"
12:76:15.2986  13 CREATE                "cmd/fsnotify/main.go"
12:76:15.2986  14 WRITE      (modified) "cmd/fsnotify/main.go"
12:76:15.2988  15 WRITE      (modified) "cmd/fsnotify/main.go"
12:76:15.3024  16 CHMOD                 "cmd/fsnotify/main.go"
^C

It's mostly the same as the example in the README, except that it takes
paths from the commandline and aligns things a bit nicer.

This is useful for documentation and experimentation. For example, while
reviewing some PRs I found it useful to quickly get an overview of "what
does fsnotify do now, and what does it do with this patch?"

3 years agokqueue: better error if watching a file fails (#471)
Martin Tournoij [Fri, 29 Jul 2022 18:28:22 +0000 (20:28 +0200)]
kqueue: better error if watching a file fails (#471)

kqueue requires opening a file descriptor for every file; so we read the
directory and do that. If this failed the error was quite unclear; for
example:

"/tmp/fsnotify_permission_denied/": permission denied

This puts the filepath in there:

"/tmp/fsnotify_permission_denied/": "/tmp/fsnotify_permission_denied/test2.log": permission denied

Fixes #270

3 years agoReplace Use of Kthread-blocking Epoll with Poller Read, Remove Per-Event LStats on...
OtoMAN [Sun, 24 Jul 2022 10:50:47 +0000 (03:50 -0700)]
Replace Use of Kthread-blocking Epoll with Poller Read, Remove Per-Event LStats on Linux #433 (#434)

* Replaced use of raw epoll with netpoller read

* Remove Debian 6 Vagrant test; it's in #469 now

* Added ignoreLinux lstats back in

* Update test

Co-authored-by: Martin Tournoij <martin@arp242.net>
3 years agoTest some more things in CI (#469)
Martin Tournoij [Sun, 24 Jul 2022 09:22:52 +0000 (11:22 +0200)]
Test some more things in CI (#469)

* Test some more things in CI

- Test all GOOS/GOARCH combinations by looping over "go tool dist list";
this just tests if it compiles.

- Add a Vagrant box to test Debian 6 / Linux 2.6.32; this was adapted
from @horahoradev's patch at #434.

- Update the minimum version requirements: we test Linux 2.6.32 now and
  turns out that's also the minimum version [Go supports] in recent
  releases, so just set it to that.

  Need Go 1.16 for retract in go.mod. I don't know, maybe we can just
  remove the retract? Latest Debian ships with Go 1.15.

  [Go supports]: https://github.com/golang/go/issues/45964

- Test both Go 1.16 and 1.18 (the lowest supported version and newest
  version). I guess we could also test 1.17, but the CI already takes
  somewhat long and I can't recall ever having a situation where an
  intermediate version failed.

- Test macOS 11 and 12; macOS 10.15 will (probably) end support in
  November, so probably not worth supporting this. GitHub will [remove]
  support for this at the end of August.

  [remove]: https://github.blog/changelog/2022-07-20-github-actions-the-macos-10-15-actions-runner-image-is-being-deprecated-and-will-be-removed-by-8-30-22/

- Test OpenBSD, NetBSD.

- Move "lint" to its own YAML file.

Future work:

- Actually run tests for all systems Go supports. Bit pointless right
  now as many of these don't do anything. Currently untested are
  Solaris, illumios, plan9, AIX, Android, iOS, DragonflyBSD, WASM.

  Some of these might be difficult (AIX, iOS, Android), but haven't
  looked in to it. I tried setting up Solaris with the
  vmactions/solaris, but it doesn't seem to have an easy way to install
  Go.

- GitHub only [supports] Windows Server 2019 and 2022; probabably also
  want to test Server 2016, but GitHub dropped support for this. Can
  maybe use AppVeyor(?)

  [supports]: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners

- Could maybe test older versions of BSD, too. Not sure of it's worth
  it.

* Skip TestFsnotifyMultipleOperations on NetBSD

This test doesn't seem to work; I'm sure it passed at least once in the
CI, but locally I can't seem to get it to work.

Fails with:

=== RUN   TestFsnotifyMultipleOperations
     integration_test.go:114: event received: "/tmp/fsnotify2194826986/TestFsnotifySeq.testfile": CREATE
     integration_test.go:114: event received: "/tmp/fsnotify2194826986/TestFsnotifySeq.testfile": WRITE
     integration_test.go:114: event received: "/tmp/fsnotify2194826986/TestFsnotifySeq.testfile": REMOVE|RENAME
     integration_test.go:114: event received: "/tmp/fsnotify2194826986/TestFsnotifySeq.testfile": CREATE
     integration_test.go:186: incorrect number of rename+delete events received after 500 ms (2 vs 1)
     integration_test.go:114: event received: "/tmp/fsnotify2194826986/TestFsnotifySeq.testfile": REMOVE
     integration_test.go:114: event received: "/tmp/fsnotify2194826986": REMOVE|WRITE

For reference, this is the output on Linux and OpenBSD (the output is
identical):

=== RUN   TestFsnotifyMultipleOperations
     integration_test.go:114: event received: "/tmp/fsnotify989736723/TestFsnotifySeq.testfile": CREATE
     integration_test.go:114: event received: "/tmp/fsnotify989736723/TestFsnotifySeq.testfile": WRITE
     integration_test.go:114: event received: "/tmp/fsnotify989736723/TestFsnotifySeq.testfile": RENAME
     integration_test.go:114: event received: "/tmp/fsnotify989736723/TestFsnotifySeq.testfile": CREATE
     integration_test.go:190: calling Close()
     integration_test.go:192: waiting for the event channel to become closed...
     integration_test.go:195: event channel closed

* Fix "too many open files" on Debian 6, maybe

I guess this started failing after I rebased on main; let's see if a
small sleep works to clean up the file descriptors.

3 years agoAdd missing changelog for 1.4.{8,9} (#468)
Martin Tournoij [Sun, 24 Jul 2022 09:22:28 +0000 (11:22 +0200)]
Add missing changelog for 1.4.{8,9} (#468)

Just copied from the releases page: https://github.com/fsnotify/fsnotify/releases

Fixes #332

3 years agoinotify: fix race in Close() (#465)
Martin Tournoij [Fri, 22 Jul 2022 05:22:49 +0000 (07:22 +0200)]
inotify: fix race in Close() (#465)

Would sometimes fail with:

panic: close of closed channel

goroutine 204 [running]:
github.com/fsnotify/fsnotify.(*Watcher).Close(0xc0003e6410)
         /home/martin/code/Golib/fsnotify/inotify.go:82 +0x66
created by github.com/fsnotify/fsnotify.TestCloseRace
         /home/martin/code/Golib/fsnotify/integration_test.go:1256 +0x1a5
exit status 2

Because isClosed() might return "false" for two goroutines, and then
they will both try to close it, resulting in the panic.

Fixes #367

3 years agoClarify README on network drives (#467)
Martin Tournoij [Fri, 22 Jul 2022 05:22:31 +0000 (07:22 +0200)]
Clarify README on network drives (#467)

3 years agoUpdate link to CONTRIBUTING in the README (#464)
John Olheiser [Fri, 22 Jul 2022 01:37:07 +0000 (20:37 -0500)]
Update link to CONTRIBUTING in the README (#464)

3 years agoUpdate documentation for linux systems (max_user_watches) (#287)
Sascha Grunert [Thu, 21 Jul 2022 11:52:49 +0000 (13:52 +0200)]
Update documentation for linux systems (max_user_watches) (#287)

* Update documentation for linux systems

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
* Rewrite a bit for clarity

Co-authored-by: Martin Tournoij <martin@arp242.net>
3 years agobump up GitHub Actions (#461)
ICHINOSE Shogo [Thu, 21 Jul 2022 11:32:59 +0000 (20:32 +0900)]
bump up GitHub Actions (#461)

- bump actions/setup-go from v2 to v3
- bump actions/checkout from v2 to v3
- bump vmactions/freebsd-vm from v0.1.5 to v0.2.0

3 years agoDo not suppress Chmod on non-existent file (#260)
Kir Kolyshkin [Thu, 21 Jul 2022 11:32:11 +0000 (04:32 -0700)]
Do not suppress Chmod on non-existent file (#260)

Currently fsnotify suppresses a Chmod event if the file does not exist
when the event is received.

This makes it impossible to use fsnotify to detect when an opened file
is removed. In such case the Linux kernel sends IN_ATTRIB event,
as described in inotify(7) man page:

> IN_ATTRIB (*)
>        Metadata  changed—for example, permissions (e.g., chmod(2)),
>        timestamps (e.g., utimensat(2)), extended attributes  (setx‐
>        attr(2)), link count (since Linux 2.6.25; e.g., for the tar‐
>        get of link(2) and for unlink(2)), and user/group ID  (e.g.,
>        chown(2)).

(to clarify, in this very case it's link count that changes).

To fix:
 * Modify the code to only suppress MODIFY and CREATE events.
 * Add a test case to verify Chmod event is delivered.

While at it, fix the comment in ignoreLinux() to use the up-to-date
terminology (event ops).

A test case is added.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
3 years agokqueue: Make watcher.Close() O(n) instead of O(n^2) (#233)
Nick Santos [Thu, 21 Jul 2022 10:20:14 +0000 (11:20 +0100)]
kqueue: Make watcher.Close() O(n) instead of O(n^2) (#233)

In the old implementation watcher.Close() would clone the list of
watches and then run Remove() on that, and every Remove() call would
iterate over the full list of watches.

This stores the watches more efficiently so that Remove() doesn't need
to iterate over the full list: instead of merely a path → fd map, it
also stores a parent-path → list-of-files.

No functional changes, just a performance improvement.

3 years agostrings.Builder instead of bytes.Buffer (#285)
Ilan Pillemer [Thu, 21 Jul 2022 07:39:21 +0000 (08:39 +0100)]
strings.Builder instead of bytes.Buffer (#285)

3 years agoExplicit mutext (un)locking (#462)
John Olheiser [Thu, 21 Jul 2022 07:25:52 +0000 (02:25 -0500)]
Explicit mutext (un)locking (#462)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
3 years agoUse common error when removing an unwatched file (#460)
Martin Tournoij [Thu, 21 Jul 2022 03:06:57 +0000 (05:06 +0200)]
Use common error when removing an unwatched file (#460)

The errors returned by the various implementations of the watcher are all different
which makes handling them difficult. This PR follows the suggestion in:
https://github.com/fsnotify/fsnotify/pull/455#issuecomment-1146037157 by @mattn
to create a common error which is wrapped by the implementations.

Replaces: https://github.com/fsnotify/fsnotify/pull/455
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
3 years agowindows: protect access to isClosed with mutex (#454)
Robert Fratto [Thu, 21 Jul 2022 03:06:40 +0000 (23:06 -0400)]
windows: protect access to isClosed with mutex (#454)

isClosed may be read and modified concurrently if the Windows Watcher is
closed at the same time as a new entry being added. This change protects
isClosed to prevent race conditions.

The order of fields for the Windows Watcher have been rearranged to
group fields protected by the mutex together.

3 years agoTest Go 1.18
Martin Tournoij [Thu, 21 Jul 2022 02:13:51 +0000 (04:13 +0200)]
Test Go 1.18

3 years agoThis project is archived (#459)
Nathan Youngman [Fri, 8 Jul 2022 16:16:12 +0000 (10:16 -0600)]
This project is archived (#459)

3 years agoPrepare for v1.5.4 (#448)
ICHINOSE Shogo [Wed, 27 Apr 2022 02:06:09 +0000 (11:06 +0900)]
Prepare for v1.5.4 (#448)

* Update Changelog
* Retracted v1.5.3

3 years agoWindows: add missing defer to Watcher.WatchList (#447)
Sojamann [Sun, 24 Apr 2022 03:11:44 +0000 (03:11 +0000)]
Windows: add missing defer to Watcher.WatchList (#447)

3 years agoREADME.md: link to pkg.go.dev for golang.org/x/sys package (#441)
Tobias Klauser [Sun, 24 Apr 2022 03:11:16 +0000 (05:11 +0200)]
README.md: link to pkg.go.dev for golang.org/x/sys package (#441)

Also add a link to the syscall package and remove some trailing
whitespaces.

3 years agogo.mod: use latest x/sys (#444)
Kevin Burke [Sun, 24 Apr 2022 02:56:16 +0000 (19:56 -0700)]
go.mod: use latest x/sys (#444)

This version contains several upgrades including a newer version of
glibc and some bug fixes.

3 years agoFix compilation for OpenBSD (#443)
mattn [Thu, 21 Apr 2022 18:01:20 +0000 (03:01 +0900)]
Fix compilation for OpenBSD (#443)

Closes #442

3 years agoAdd a feature to return the directories and files that are being monitored (#374)
NitroCao [Thu, 21 Apr 2022 06:46:51 +0000 (14:46 +0800)]
Add a feature to return the directories and files that are being monitored (#374)

* Add a feature to return the directories and files that are being monitored

* add WatchList() method for bsd and windows platforms

* preallocate space for the array to be returned

3 years agoFix potential crash on windows if raw.FileNameLength exceeds syscall.MAX_PATH (#361)
Hangkun Ung [Wed, 26 Jan 2022 13:21:14 +0000 (08:21 -0500)]
Fix potential crash on windows if raw.FileNameLength exceeds syscall.MAX_PATH (#361)

* Fix crash on windows if raw.FileNameLength exceeds syscall.MAX_PATH

* Add comment

* Update windows.go

3 years agoAllow build on unsupported GOOS (#424)
Tobias Klauser [Tue, 25 Jan 2022 02:13:06 +0000 (03:13 +0100)]
Allow build on unsupported GOOS (#424)

In cases where fsnotify is a transitive dependency of a package, it
might need to be built on platforms not supported (yet), e.g. aix.
Provide an empty implemention for these cases, so depending packages
don't need to add workarounds.

Replaces #314

3 years agoAdd FreeBSD testing in Github Actions (#419)
Roey Darwish Dror [Mon, 24 Jan 2022 01:28:23 +0000 (03:28 +0200)]
Add FreeBSD testing in Github Actions (#419)

Fixes #389

3 years agoIntegration Tests: consistent sleeps with informative names (#422)
Nahum Shalman [Thu, 20 Jan 2022 02:37:34 +0000 (21:37 -0500)]
Integration Tests: consistent sleeps with informative names (#422)

* Change 1ms sleeps to 50ms
* Use const variable names to indicate why we are sleeping

3 years agoEnable cross-compilation builds on PRs (#423)
Nahum Shalman [Thu, 20 Jan 2022 02:33:55 +0000 (21:33 -0500)]
Enable cross-compilation builds on PRs (#423)

3 years agoRe-enable tests for PRs (#415)
Nahum Shalman [Thu, 20 Jan 2022 01:31:12 +0000 (20:31 -0500)]
Re-enable tests for PRs (#415)

It would be good to re-enable tests on PRs.

3 years agoDon't set poller.fd twice in newFdPoller (#406)
Tobias Klauser [Wed, 19 Jan 2022 14:22:52 +0000 (15:22 +0100)]
Don't set poller.fd twice in newFdPoller (#406)

In newEmptyPoller when creating the poller using newEmptyPoller(fd), the
fd field of the poller instance is already set. There is no need to set
it again.

3 years agoRun cross-compilation builds on every push (#420)
Nahum Shalman [Wed, 19 Jan 2022 02:29:44 +0000 (21:29 -0500)]
Run cross-compilation builds on every push (#420)

This would have caught #389 and should
catch build failures for supported targets.

3 years agofix go vet warnings: call to (*T).Fatalf from a non-test goroutine (#416)
Ichinose Shogo [Mon, 17 Jan 2022 14:35:07 +0000 (23:35 +0900)]
fix go vet warnings: call to (*T).Fatalf from a non-test goroutine (#416)

3 years agoFinal Notice: Maintainers Wanted
Nathan Youngman [Fri, 14 Jan 2022 07:26:03 +0000 (00:26 -0700)]
Final Notice: Maintainers Wanted

3 years agomaintainers wanted
Nathan Youngman [Fri, 14 Jan 2022 05:07:14 +0000 (22:07 -0700)]
maintainers wanted

3 years agorevise contributing
Nathan Youngman [Fri, 14 Jan 2022 04:38:49 +0000 (21:38 -0700)]
revise contributing

3 years agoupdate readme
Nathan Youngman [Fri, 14 Jan 2022 04:35:17 +0000 (21:35 -0700)]
update readme

3 years agoTest on Go 1.18 and two most recent versions (#411)
Nathan Youngman [Fri, 14 Jan 2022 03:49:28 +0000 (20:49 -0700)]
Test on Go 1.18 and two most recent versions (#411)

* Test on Go 1.18 and two most recent versions

* on push

* ci

3 years agoUpdate issue templates (#410)
Nathan Youngman [Fri, 14 Jan 2022 03:02:46 +0000 (20:02 -0700)]
Update issue templates (#410)

* Update issue templates

* remove old issue template

3 years agoRemoved dead link
Loïc Vernet [Thu, 7 May 2020 14:06:57 +0000 (16:06 +0200)]
Removed dead link

4 years agoprepare 1.5.1, retract 1.5.0
Nathan Youngman [Tue, 24 Aug 2021 19:33:30 +0000 (13:33 -0600)]
prepare 1.5.1, retract 1.5.0

4 years agoRevert "Add AddRaw to not follow symlinks + Fix link folloing on Windows (#289)"
Nathan Youngman [Tue, 24 Aug 2021 19:09:43 +0000 (13:09 -0600)]
Revert "Add AddRaw to not follow symlinks + Fix link folloing on Windows (#289)"

This reverts commit e2e95171bc7c7402864e613c8b00a768fbcc2380.

4 years agorevise pull request template
Nathan Youngman [Tue, 24 Aug 2021 00:34:28 +0000 (18:34 -0600)]
revise pull request template

4 years agov1.5.0 preparation (#380)
Oliver Bristow [Wed, 18 Aug 2021 22:48:34 +0000 (23:48 +0100)]
v1.5.0 preparation (#380)

4 years agoAdd AddRaw to not follow symlinks + Fix link folloing on Windows (#289)
Oliver Bristow [Wed, 18 Aug 2021 21:08:44 +0000 (22:08 +0100)]
Add AddRaw to not follow symlinks + Fix link folloing on Windows (#289)

4 years agoUpdate test matrix for go 1.17 stable release (#385)
Nahum Shalman [Tue, 17 Aug 2021 14:33:47 +0000 (10:33 -0400)]
Update test matrix for go 1.17 stable release (#385)

4 years agoadd //go:build lines + add 1.17.0-rc2 to test matrix (#377)
Ichinose Shogo [Wed, 4 Aug 2021 20:19:43 +0000 (05:19 +0900)]
add //go:build lines + add 1.17.0-rc2 to test matrix (#377)

4 years agoUpdate x/sys to latest (#379)
Nahum Shalman [Wed, 4 Aug 2021 19:53:11 +0000 (15:53 -0400)]
Update x/sys to latest (#379)

4 years agoDrop support/testing for Go 1.11 and earlier (#381)
Nahum Shalman [Wed, 4 Aug 2021 19:46:51 +0000 (15:46 -0400)]
Drop support/testing for Go 1.11 and earlier (#381)

4 years agoRemove Travis CI and references
Oliver Bristow [Sun, 1 Aug 2021 10:11:11 +0000 (11:11 +0100)]
Remove Travis CI and references

4 years agoAdd lint+vet+old versions to GitHub Action
Oliver Bristow [Sun, 1 Aug 2021 09:19:38 +0000 (10:19 +0100)]
Add lint+vet+old versions to GitHub Action

4 years agointroduce GitHub Actions
Ichinose Shogo [Sat, 31 Jul 2021 07:13:10 +0000 (16:13 +0900)]
introduce GitHub Actions

5 years agoFix unsafe pointer conversion (#325)
Tobias Klauser [Fri, 17 Apr 2020 21:56:12 +0000 (23:56 +0200)]
Fix unsafe pointer conversion (#325)

Fix the following unsafe pointer conversion found using the Go 1.14
-d=checkptr gcflags (`go1.14rc1 test -gcflags=all=-d=checkptr -v ./...`)

```
fatal error: checkptr: unsafe pointer conversion

goroutine 68 [running]:
runtime.throw(0x5833e9, 0x23)
runtime/panic.go:1112 +0x72 fp=0xc00030fba8 sp=0xc00030fb78 pc=0x432a32
runtime.checkptrAlignment(0xc00031f018, 0x544800, 0x1)
runtime/checkptr.go:18 +0xb7 fp=0xc00030fbd8 sp=0xc00030fba8 pc=0x4063a7
github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc0002900f0)
github.com/fsnotify/fsnotify/inotify.go:275 +0x457 fp=0xc00031ffd8 sp=0xc00030fbd8 pc=0x519037
runtime.goexit()
runtime/asm_amd64.s:1375 +0x1 fp=0xc00031ffe0 sp=0xc00031ffd8 pc=0x463eb1
created by github.com/fsnotify/fsnotify.NewWatcher
github.com/fsnotify/fsnotify/inotify.go:59 +0x1a5
```

Fixes #330

5 years agoMove example usage to the readme
Nathan Youngman [Wed, 11 Mar 2020 16:36:45 +0000 (10:36 -0600)]
Move example usage to the readme

may resolve #328

6 years agoUpdating the FAQ section for supportability with NFS & FUSE filesystems.
Pratik Shinde [Mon, 7 Oct 2019 09:55:39 +0000 (15:25 +0530)]
Updating the FAQ section for supportability with NFS & FUSE filesystems.

closes #312 #306

6 years agodrop 1.8.x from Travis CI
Nathan Youngman [Sat, 5 Oct 2019 23:39:47 +0000 (17:39 -0600)]
drop 1.8.x from Travis CI

see #310

6 years ago2019
Nathan Youngman [Sat, 5 Oct 2019 23:12:31 +0000 (17:12 -0600)]
2019

6 years agorevise editor config
Nathan Youngman [Sat, 5 Oct 2019 23:12:25 +0000 (17:12 -0600)]
revise editor config

tabs only for Go

6 years agoAdd Go modules
Nathan Youngman [Sat, 5 Oct 2019 23:12:12 +0000 (17:12 -0600)]
Add Go modules

6 years agoreadme: plan to support fanotify
Nathan Youngman [Sat, 5 Oct 2019 22:41:51 +0000 (16:41 -0600)]
readme: plan to support fanotify

6 years agoOpen files with CLOEXEC
Eric Lin [Thu, 25 Oct 2018 04:24:55 +0000 (12:24 +0800)]
Open files with CLOEXEC

Fix #272

6 years agoAlso create epoll and pipe fds with close-on-exec (#155) (#219)
Johannes Ebke [Tue, 12 Mar 2019 18:14:46 +0000 (19:14 +0100)]
Also create epoll and pipe fds with close-on-exec (#155) (#219)

* Add the unix.O_CLOEXEC to the Pipe2 call
* Add unix.EPOLL_CLOEXEC to the Epoll call

6 years agoreadme: remove AppVeyor badge
Nathan Youngman [Fri, 8 Mar 2019 17:06:45 +0000 (10:06 -0700)]
readme: remove AppVeyor badge

Use Travis CI for Windows #284

6 years agoAdd windows to travis matrix
Brian Goff [Fri, 8 Mar 2019 06:23:41 +0000 (22:23 -0800)]
Add windows to travis matrix

6 years agoFix lint issue with error doc string
Brian Goff [Fri, 8 Mar 2019 03:54:56 +0000 (19:54 -0800)]
Fix lint issue with error doc string

6 years agoonly run golint on latest version of go
Brian Goff [Mon, 4 Mar 2019 19:11:11 +0000 (11:11 -0800)]
only run golint on latest version of go

7 years agoCheck if channels are closed in the example (#244)
Alexey Kazakov [Thu, 30 Aug 2018 22:02:26 +0000 (15:02 -0700)]
Check if channels are closed in the example (#244)

* Check if channels are closed in the example

* Check if the channels are closed before printing

7 years agodarwin tests: Exchangedata is deprecated on 10.13
Nathan Youngman [Thu, 30 Aug 2018 20:16:33 +0000 (14:16 -0600)]
darwin tests: Exchangedata is deprecated on 10.13

#264

7 years agotravis: less verbose tests
Nathan Youngman [Thu, 30 Aug 2018 20:13:18 +0000 (14:13 -0600)]
travis: less verbose tests

TravisCI: skip tip

7 years ago[#234] t.Fatalf -> t.Errorf in go routines (#266)
Gautam Dey [Thu, 30 Aug 2018 20:59:23 +0000 (14:59 -0600)]
[#234] t.Fatalf -> t.Errorf in go routines (#266)

The documentation for t.FailNow (which is called by t.Fatalf) states
that it should not be called in go routines outside of the test go
routine.

7 years agoFix TestInotifyOverflow (#265)
Matthias Stone [Thu, 30 Aug 2018 20:03:37 +0000 (14:03 -0600)]
Fix TestInotifyOverflow (#265)

* Queued inotify events could have been read by the test before max_queued_events was hit

7 years agoTravisCI: updating test versions
Nathan Youngman [Thu, 30 Aug 2018 15:48:21 +0000 (09:48 -0600)]
TravisCI: updating test versions

7 years agov1.4.7
Nathan Youngman [Wed, 10 Jan 2018 05:33:47 +0000 (22:33 -0700)]
v1.4.7

closes #222

[ci skip]

7 years agotravis: test on Go 1.9.x
Nathan Youngman [Wed, 10 Jan 2018 04:31:13 +0000 (21:31 -0700)]
travis: test on Go 1.9.x

7 years agoFix missing verb on format string (#228)
Rodrigo Chiossi [Wed, 10 Jan 2018 04:20:58 +0000 (02:20 -0200)]
Fix missing verb on format string (#228)

7 years agoFix possible deadlock on closing the watcher on kqueue (#230)
Anmol Sethi [Wed, 10 Jan 2018 04:19:26 +0000 (23:19 -0500)]
Fix possible deadlock on closing the watcher on kqueue (#230)

* avoid deadlocks on Close()

raw channel work (not inside a select) should
always be prohibited in production code, as
it readily causes deadlocks on shutdown.

Also adds the test TestWatcherClose from #145.
This request duplicates that test, with two
lines fixed to address the houndcli-bot review
concerns.

Fixes #187
Fixes #145

* cleanup and simpler test

* also fix #225

* fix tests

8 years agoFix deadlock in Remove (linux/inotify)
Aaron L [Wed, 29 Mar 2017 04:21:07 +0000 (21:21 -0700)]
Fix deadlock in Remove (linux/inotify)

Several people have reported this issue where if you are using a
single goroutine to watch for fs events and you call Remove in
that goroutine it can deadlock. The cause for this is that the Remove
was made synchronous by PR #73. The reason for this was to try and
ensure that maps were no longer leaking.

In this PR: IN_IGNORE was used as the event to ensure map cleanup.
This worked fine when Remove() was called and the next event was
IN_IGNORE, but when a different event was received the main goroutine
that's supposed to be reading from the Events channel would be stuck
waiting for the sync.Cond, which would never be hit because the select
would then block waiting for someone to receive the non-IN_IGNORE event
from the channel so it could proceed to process the IN_IGNORE event that
was waiting in the queue. Deadlock :)

Removing the synchronization then created two nasty races where Remove
followed by Remove would error unnecessarily, and one where Remove
followed by an Add could result in the maps being cleaned up AFTER the
Add call which means the inotify watch is active, but our maps don't
have the values anymore. It then becomes impossible to delete the
watches via the fsnotify code since it checks it's local data before
calling InotifyRemove.

This code attempts to use IN_DELETE_SELF as a means to know when a watch
was deleted as part of an unlink(). That means that we didn't delete the
watch via the fsnotify lib and we should clean up our maps since that
watch no longer exists. This allows us to clean up the maps immediately
when calling Remove since we no longer try to synchronize cleanup
using IN_IGNORE as the sync point.

- Fix #195
- Fix #123
- Fix #115

8 years agoWatch.Add improvements (avoid race, fix consistency, reduce garbage) (#189)
Tom Payne [Tue, 21 Mar 2017 12:55:22 +0000 (13:55 +0100)]
Watch.Add improvements (avoid race, fix consistency, reduce garbage) (#189)

* hold mutex for longer to avoid race condition

If Watcher.Add is called with the same name from multiple goroutines and
name is not already in the watches map then the last call to complete
wins and the watch created by the first call to complete is lost.

This commit holds the mutex for the full duration of the update to the
watches map.

* avoid clobbering existing flags if inotify_add_watch fails

Previously, the watch entry is the watches map was updated before the
call to InotifyAddWatch. If InotifyAddWatch fails then this left the
watch entry in an inconsistent state.

* reuse existing watch entry when possible

8 years agotravis: update for Go 1.8
Nathan Youngman [Tue, 16 Aug 2016 05:19:40 +0000 (23:19 -0600)]
travis: update for Go 1.8

two most recent stable versions + tip

8 years agoMoved FAQ into the README
Vahe Khachikyan [Wed, 2 Nov 2016 19:13:10 +0000 (15:13 -0400)]
Moved FAQ into the README

closes #186
ref #129

[ci skip]

9 years agoProperly handle inotify's IN_Q_OVERFLOW event (#149)
Nickolai Zeldovich [Wed, 26 Oct 2016 20:31:22 +0000 (16:31 -0400)]
Properly handle inotify's IN_Q_OVERFLOW event (#149)

* Properly handle inotify's IN_Q_OVERFLOW event

Upon receiving an event with IN_Q_OVERFLOW set in the mask, generate an
error on the Errors chan, so that the application can take appropriate
action.

* Use a well-defined error (ErrEventOverflow) for inotify overflow

* Add a test for inotify queue overflow

9 years agoreplace references to OS X with macOS
Nathan Youngman [Thu, 13 Oct 2016 01:22:19 +0000 (19:22 -0600)]
replace references to OS X with macOS

[ci skip]

9 years agov1.4.2
Nathan Youngman [Tue, 11 Oct 2016 02:33:12 +0000 (20:33 -0600)]
v1.4.2

9 years agopull request and issue template (#179)
Nathan Youngman [Tue, 11 Oct 2016 02:25:47 +0000 (20:25 -0600)]
pull request and issue template (#179)

* editor config sets 4 spaces per tab

via https://github.com/isaacs/github/issues/170#issuecomment-181814560

[ci skip]

* pull request and issue templates

https://help.github.com/articles/helping-people-contribute-to-your-project/

[ci skip]

* issue template: provide commands to get OS version

suggested by @mdlayher

[ci skip]

9 years agoCreate inotify fd with close-on-exec (#178)
Patrick [Tue, 11 Oct 2016 02:24:00 +0000 (19:24 -0700)]
Create inotify fd with close-on-exec (#178)

* Create inotify fd with close-on-exec

* switch to unix.IN_CLOEXEC

9 years agov1.4.1
Nathan Youngman [Wed, 5 Oct 2016 04:06:20 +0000 (22:06 -0600)]
v1.4.1

9 years agodeflake inotify stress test (#177)
Patrick [Wed, 5 Oct 2016 03:39:39 +0000 (20:39 -0700)]
deflake inotify stress test (#177)

* deflake inotify stress test

* tab -> space

* add sleep between creation / deletion to ensure creation events are triggered.

9 years agorm go1.5.4 from travis config since the linter doesn't build in 1.5 (#175)
Patrick [Wed, 5 Oct 2016 02:09:41 +0000 (19:09 -0700)]
rm go1.5.4 from travis config since the linter doesn't build in 1.5 (#175)

9 years agoreadme: remove gocover.io badge
Nathan Youngman [Sun, 2 Oct 2016 05:17:20 +0000 (23:17 -0600)]
readme: remove gocover.io badge

[ci skip]

9 years agoupdate link to contributing to external git repos
Nathan Youngman [Sun, 2 Oct 2016 05:09:12 +0000 (23:09 -0600)]
update link to contributing to external git repos

[ci skip]

9 years agov1.4.0
Nathan Youngman [Sun, 2 Oct 2016 04:59:51 +0000 (22:59 -0600)]
v1.4.0