From 354ed5e20fcf211376acf21cde0f651742571a03 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Wed, 11 Jun 2025 15:39:31 +0200 Subject: [PATCH 1/2] deprecated memcpy -> copyBytes This is the basefunction the memcpy deprecation from Bytestring suggests. --- System/Fuse.hsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/System/Fuse.hsc b/System/Fuse.hsc index d412145..4343c01 100644 --- a/System/Fuse.hsc +++ b/System/Fuse.hsc @@ -67,6 +67,7 @@ import Foreign import Foreign.C import Foreign.C.Error import Foreign.Marshal +import Foreign.Marshal.Utils (copyBytes) import System.Environment ( getProgName, getArgs ) import System.IO ( hPutStrLn, stderr, withFile, stdin, stdout, IOMode(..) ) import System.Posix.Types @@ -1162,7 +1163,7 @@ foreign import ccall safe "wrapper" bsToBuf :: Ptr a -> B.ByteString -> Int -> IO () bsToBuf dst bs len = do let l = fromIntegral $ min len $ B.length bs - B.unsafeUseAsCString bs $ \src -> B.memcpy (castPtr dst) (castPtr src) l + B.unsafeUseAsCString bs $ \src -> copyBytes (castPtr dst) (castPtr src) l return () -- Get filehandle From d6d0aa743b8e5a7db79ba9ed74678672a9e8fb6d Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Wed, 11 Jun 2025 15:40:35 +0200 Subject: [PATCH 2/2] Fix broken OpenFileFlags construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit newer versions of base added more fields, so instead let’s use the default constructor to be forward-compatible with them. --- System/Fuse.hsc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/System/Fuse.hsc b/System/Fuse.hsc index 4343c01..acfddce 100644 --- a/System/Fuse.hsc +++ b/System/Fuse.hsc @@ -74,7 +74,7 @@ import System.Posix.Types import System.Posix.Files ( accessModes, intersectFileModes, unionFileModes ) import System.Posix.Directory(changeWorkingDirectory) import System.Posix.Process(forkProcess,createSession,exitImmediately) -import System.Posix.IO ( OpenMode(..), OpenFileFlags(..) ) +import System.Posix.IO ( OpenMode(..), OpenFileFlags(..), defaultFileFlags ) import qualified System.Posix.Signals as Signals import GHC.IO.Handle(hDuplicateTo) import System.Exit @@ -602,7 +602,7 @@ withStructFuse pFuseChan pArgs ops handler f = how | (#const O_RDWR) .&. flags == (#const O_RDWR) = ReadWrite | (#const O_WRONLY) .&. flags == (#const O_WRONLY) = WriteOnly | otherwise = ReadOnly - openFileFlags = OpenFileFlags { append = append + openFileFlags = defaultFileFlags { append = append , exclusive = False , noctty = noctty , nonBlock = nonBlock