May 8, 2014

Currently, the haskell fuse binding is not compiling when installing it using cabal.

The error message which is reported by $ cabal install hfuse is:

System/Fuse.hsc:73:40:
      Module `System.IO.Error' does not export `catch'

The reason is that catch was moved from System.IO.Error to Control.Exception.

Here is a patch for that (based on the one from Colin Watson):

diff --git a/System/Fuse.hsc b/System/Fuse.hsc
index f7347fd..9e9e423 100644
--- a/System/Fuse.hsc
+++ b/System/Fuse.hsc
@@ -20,7 +20,7 @@
 -- option).
 --
 -----------------------------------------------------------------------------
-{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleContexts, RankNTypes #-}
 module System.Fuse
     ( -- * Using FUSE
 
@@ -52,7 +52,7 @@ module System.Fuse
 import Prelude hiding ( Read )
 
 import Control.Monad
-import Control.Exception as E(Exception, handle, finally, SomeException)
+import Control.Exception as E(catch, Exception, IOException, handle, finally, SomeException)
 import qualified Data.ByteString.Char8    as B
 import qualified Data.ByteString.Internal as B
 import qualified Data.ByteString.Unsafe   as B
@@ -70,7 +70,7 @@ import System.Posix.IO ( OpenMode(..), OpenFileFlags(..) )
 import qualified System.Posix.Signals as Signals
 import GHC.IO.Handle(hDuplicateTo)
 import System.Exit
-import qualified System.IO.Error as IO(catch,ioeGetErrorString)
+import qualified System.IO.Error as IO(ioeGetErrorString)
 
 -- TODO: FileMode -> Permissions
 -- TODO: Arguments !
@@ -757,7 +757,7 @@ fuseParseCommandLine pArgs =
 -- Mimic's daemon()s use of _exit() instead of exit(); we depend on this in fuseMainReal,
 -- because otherwise we'll unmount the filesystem when the foreground process exits.
 daemon f = forkProcess d >> exitImmediately ExitSuccess
-  where d = IO.catch (do createSession
+  where d = E.catch (do createSession
                          changeWorkingDirectory "/"
                          -- need to open /dev/null twice because hDuplicateTo can't dup a ReadWriteMode to a ReadMode handle
                          withFile "/dev/null" WriteMode (\devNullOut ->
@@ -766,7 +766,7 @@ daemon f = forkProcess d >> exitImmediately ExitSuccess
                          withFile "/dev/null" ReadMode (\devNullIn -> hDuplicateTo devNullIn stdin)
                          f
                          exitWith ExitSuccess)
-                     (const exitFailure)
+                     (\(_ :: IOException) -> exitFailure)
 
 -- Installs signal handlers for the duration of the main loop.
 withSignalHandlers exitHandler f =
@@ -843,7 +843,7 @@ fuseMain ops handler = do
 
 fuseRun :: String -> [String] -> Exception e => FuseOperations fh -> (e -> IO Errno) -> IO ()
 fuseRun prog args ops handler =
-    IO.catch
+    E.catch
        (withFuseArgs prog args (\pArgs ->
          do cmd <- fuseParseCommandLine pArgs
             case cmd of

Just download the above patch save it into a file named hfuse-catch.patch and run the following:

$ git clone git@github.com:realdesktop/hfuse.git
$ cd hfuse
$ git apply hfuse-catch.patch
$ cabal configure && cabal build && cabal install
comments powered by Disqus

Topics:
Keywords: