haskell-fswatch / hfsnotify

Unified Haskell interface for basic file system notifications
BSD 3-Clause "New" or "Revised" License
136 stars 40 forks source link

Problems with fsnotify-0.4.0.1 on Windows #107

Closed mpilgrem closed 1 year ago

mpilgrem commented 1 year ago

I have been having difficulties building code that depends on fsnotify-0.4.0.1 on Windows with Stack.

First, fsnotify-0.4.0.1 does not specify a lower bound for its dependency on sandwich, but sandwich did not support Windows until sandwich-0.1.1.0. This is problematic because, before nightly-2022-09-30, Stackage offers up sandwich < 0.1.1.0.

Second, the Cabal file has:

 if os(windows)
    cpp-options: -DOS_Windows

but System.FSNotify has:

#ifdef OS_Win32
import System.FSNotify.Win32
#endif

I think this means that System.FSNotify.Win32 does not get imported. Stack complains:

fsnotify             > [ 6 of 10] Compiling System.FSNotify
fsnotify             >
fsnotify             > src\System\FSNotify.hs:169:34: error:
fsnotify             >     Not in scope: type constructor or class ‘NativeManager’
fsnotify             >     |
fsnotify             > 169 |     createManager :: Either Text NativeManager -> IO WatchManager
fsnotify             >     |                                  ^^^^^^^^^^^^^
fsnotify             >
mpilgrem commented 1 year ago

I see that the first of the above matters has been addressed by 71f47f74c28563229b1fa530b5a6c5a4c1c15bbb.

I see that the second of the above matters has been addressed by a8c503261799fb2b546f52f604ad8d0325f9c8f3.

sjakobi commented 1 year ago

Should fsnotify-0.4.0.1 be revised with a bound sandwich >= 0.1.1.1? (AFAIK this would have to be an unconditional bound – Hackage doesn't support adding conditional bounds like the one added in https://github.com/haskell-fswatch/hfsnotify/commit/71f47f74c28563229b1fa530b5a6c5a4c1c15bbb yet.)

thomasjm commented 1 year ago

@sjakobi I was actually planning to do a new fsnotify minor release soon to incorporate some of those recent fixes.

If you wouldn't mind adding such a bound for 0.4.0.1 in the meantime I think that would be great. (Not sure if I'm able to do it as maintainer.)

sjakobi commented 1 year ago

If you wouldn't mind adding such a bound for 0.4.0.1 in the meantime I think that would be great.

Done (using my Hackage trustee powers) in https://hackage.haskell.org/package/fsnotify-0.4.0.1/revisions/

(Not sure if I'm able to do it as maintainer.)

You can: Either via the "edit package information" link on the Hackage page, or via hackage-cli.

BTW, I'm glad that you've turned the tests executable into a proper test-suite in https://github.com/haskell-fswatch/hfsnotify/commit/c7e9722664d0abd7e2d32cc1e9e7bb5f219b67be. Library users really shouldn't be affected by compatibility issues in test suites.

Minoru commented 1 year ago

@thomasjm Sorry for nagging, but are you still planning to make a minor release soon? The second point still makes fsnotify fail on Windows, which breaks my package for Windows users. I'm considering adding an upper bound to exclude this faulty version, but if you're releasing a new one soon, I'd rather just wait and avoid the fuss.

thomasjm commented 1 year ago

Right, sorry for the delay @Minoru -- released now as 0.4.1.0.