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

Closed
qxjit opened this issue Jan 15, 2019 · 1 comment
Closed

Comments

@qxjit
Copy link
Contributor

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-0.2.1.1 rather than fsnotify-0.3.0.1. fsnotify-0.3.0.1 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-0.2.1.1 event list

fsnotify-0.3.0.1 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)

Expected

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

Actual

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 https://github.com/commercialhaskell/stack/releases as part of docker image build (Dockerfile)
@borsboom
Copy link
Contributor

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-0.3.0.1, 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-0.2.1.1, 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-0.3.0.1 changed to listen to Modify events rather than
CloseWrite events. Switching to the new version fixes the issue.
snoyberg added a commit that referenced this issue Jan 18, 2019
Fixes #4506 - Add fsnotify-0.3.0.1 to snapshot.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants