Open supermario opened 2 months ago
I see another toEnum
usage a few lines down:
It looks like Windows gives us action enums with a value between 1 and 5 inclusive, see here.
It appears that this line is converting from the 1-based Windows indexing to the 0-based Haskell Enum indexing. But somehow Windows is sending 0 for the action, resulting in a call to (toEnum (-1))?
If you have a Windows dev machine handy, maybe you can load FileNotify.hsc
in GHCi and check that the enums (FileAction
and Action
) have the expected values?
I've had users report the following crashes happen occasionally in a scenario where we're using fsnotify to watch the disk for file changes:
I'm guessing this is related to:
https://github.com/haskell-fswatch/hfsnotify/blob/cff88823102416939a2faa01afd7913a3476cc0c/win-src/System/Win32/FileNotify.hsc#L42-L46
As it's the only place
toEnum
is used in this package. But I'm unsure what the-1
value would indicate in Windows or how to debug further.Would be happy to add debugging/instrumentation code if someone could provide some guidance, but otherwise we don't currently have a sure-fire way of replicating the issue reliably.