Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old fsnotify dependency doesn't detect file changes when using Docker for Mac #4506

qxjit opened this issue Jan 15, 2019 · 1 comment


Copy link

@qxjit qxjit commented Jan 15, 2019

General summary/comments (optional)

stack fails to respond to file modification events on OSX when run inside docker. I believe this is simply due to being built against fsnotify- rather than fsnotify- fsnotify- included changes to the Linux file listener which listen for Attrib and Modify events instead of CloseWrite. The Docker for Mac osxfs file sharing emits Modify events on file changes, but does not emit CloseWrite.

fsnotify- event list

fsnotify- event list

Steps to reproduce

  1. Run command docker run -it --rm -v $PWD:/work -w /work flipstone/stack:v2-1.9.3 bash
  2. In the dockerized bash shell, run command stack new fsevent-test.
  3. In the dockerized bash shell, run command cd fsevent-test && stack build --file-watch.
  4. Edit fsevent-test/src/Lib.hs

(In vim, you will need to ensure backupcopy is set to yes. Both the no and auto settings result in files being created/deleted in the directory and triggering extra filesystem events, masking the problem)


The stack build --file-watch command should recompile when the file is edited.


The stack build --file-watch command does not recompile when the file is edited.

Stack version

$ stack --version
Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1

Method of installation

  • Binary package downloaded from as part of docker image build (Dockerfile)
Copy link

@borsboom borsboom commented Jan 15, 2019

While Docker for Mac isn't officially supported for Stack's Docker integration (lots of little ways in which it differs from native Linux docker), we do like it to work as well as possible. Please feel free to make a PR that upgrades the fsnotify dependency in snapshot.yaml (no need to to add a lower bound to package.yaml since we use the snapshots as the source of truth for dependency versions). snapshot-lts-12.yaml and snapshot-nightly.yaml are based on newer Stackage snapshots that already have fsnotify-, so no need to change those.

qxjit added a commit to qxjit/stack that referenced this issue Jan 16, 2019
lts-11.22 includes fsnotify-, which listens to Modify events on
Linux rather than CloseWrite events. For many applications the
difference is neglible because writing a file will result in both
events, but if you run stack inside of docker on Mac this breaks
the --file-watch option because the file sharing integration only
emits Modify events, never CloseWrite events.

fsnotify- changed to listen to Modify events rather than
CloseWrite events. Switching to the new version fixes the issue.
@snoyberg snoyberg closed this in 051b67f Jan 18, 2019
snoyberg added a commit that referenced this issue Jan 18, 2019
Fixes #4506 - Add fsnotify- to snapshot.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants