Fix build on Windows
authorJoey Hess <joeyh@joeyh.name>
Thu, 19 Nov 2020 16:33:00 +0000 (12:33 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 19 Nov 2020 16:33:00 +0000 (12:33 -0400)
Thanks to bug reporter for the patch.

Annex/Content.hs
Annex/Content/Presence.hs
Assistant.hs
CHANGELOG
Logs/Transfer.hs
Remote/Directory.hs
Utility/Daemon.hs
doc/bugs/release_8.20201116_doesn__39__t_build_on_windows.mdwn

index 3bdaacd45a5f01a07ac1d9dce5356ab910b93a4e..a7535da1cd03e975e80c8e81f09ab1d7658e8891 100644 (file)
@@ -154,7 +154,7 @@ winLocker :: (LockFile -> IO (Maybe LockHandle)) -> ContentLocker
 winLocker takelock _ (Just lockfile) = do
        modifyContent lockfile $
                void $ liftIO $ tryIO $
-                       writeFile lockfile ""
+                       writeFile (fromRawFilePath lockfile) ""
        liftIO $ takelock lockfile
 -- never reached; windows always uses a separate lock file
 winLocker _ _ Nothing = return Nothing
index 3d05765fcb604c3384f3462a97530a94caf5a36c..861288c0b98dfcfdd321469ec6200d7ef762726a 100644 (file)
@@ -115,7 +115,7 @@ inAnnexSafe key = inAnnex' (fromMaybe True) (Just False) go key
                                        Nothing -> return is_locked
                                        Just lockhandle -> do
                                                dropLock lockhandle
-                                               void $ tryIO $ removeWhenExistsWith removeLink lockfile
+                                               void $ tryIO $ removeWhenExistsWith removeLink (fromRawFilePath lockfile)
                                                return is_unlocked
                        , return is_missing
                        )
index a0bbd370479bdb4c6bbce08f767501889fd2c6a8..d7e75e23de3f6af32185d16ada7bd6fd0822cb33 100644 (file)
@@ -102,7 +102,7 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
                createAnnexDirectory (parentDir logfile)
                ifM (liftIO $ isNothing <$> getEnv flag)
                        ( liftIO $ withNullHandle $ \nullh -> do
-                               loghandle <- openLog logfile
+                               loghandle <- openLog (fromRawFilePath logfile)
                                e <- getEnvironment
                                cmd <- programPath
                                ps <- getArgs
@@ -115,7 +115,7 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
                                exitcode <- withCreateProcess p $ \_ _ _ pid ->
                                        waitForProcess pid
                                exitWith exitcode
-                       , start (Utility.Daemon.foreground (Just pidfile)) $
+                       , start (Utility.Daemon.foreground (Just (fromRawFilePath pidfile))) $
                                case startbrowser of
                                        Nothing -> Nothing
                                        Just a -> Just $ a Nothing Nothing
index fe32908de638d3de4505e2b3080446c6ba108cce..e914ee55f67944c3b76f0d8714518f447e6937ff 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,6 +12,7 @@ git-annex (8.20201117) UNRELEASED; urgency=medium
   * Fix hang when an external special remote program exited but
     the stderr pipe to it was left open, due to a daemon having inherited
     the file descriptor.
+  * Fix build on Windows.
 
  -- Joey Hess <id@joeyh.name>  Mon, 16 Nov 2020 09:38:32 -0400
 
index 2722702d2f57b8e18d2990ea37a2a0e612d3d4be..369c6a630ffb87a54e2e798381ad78723551a20b 100644 (file)
@@ -131,7 +131,7 @@ checkTransfer t = debugLocks $ do
        v <- liftIO $ lockShared lck
        liftIO $ case v of
                Nothing -> catchDefaultIO Nothing $
-                       readTransferInfoFile Nothing tfile
+                       readTransferInfoFile Nothing (fromRawFilePath tfile)
                Just lockhandle -> do
                        dropLock lockhandle
                        cleanstale
index 5c20894ee38ca6b4504b1266ed3af0f464f7b165..bc5d2ab3b697162583df769b4adf81fde45fdab0 100644 (file)
@@ -258,7 +258,7 @@ removeDirGeneric topdir dir = do
 #ifdef mingw32_HOST_OS
        {- Windows needs the files inside the directory to be writable
         - before it can delete them. -}
-       void $ tryIO $ mapM_ allowWrite =<< dirContents dir
+       void $ tryIO $ mapM_ (allowWrite . toRawFilePath) =<< dirContents dir
 #endif
        tryNonAsync (removeDirectoryRecursive dir) >>= \case
                Right () -> return ()
@@ -446,7 +446,7 @@ retrieveExportWithContentIdentifierM dir loc cid dest mkkey p =
 #ifndef mingw32_HOST_OS
                        =<< getFdStatus fd
 #else
-                       =<< getFileStatus f
+                       =<< R.getFileStatus f
 #endif
                guardSameContentIdentifiers cont cid currcid
 
index 683a59263e4e83818acd3466bfb48adf2720b74c..9a34255897dc6e0e03b1ade83405640ba26b8698 100644 (file)
@@ -112,7 +112,7 @@ lockPidFile pidfile = do
        pid <- getPID
        writeFile pidfile (show pid)
        lckfile <- winLockFile pid pidfile
-       writeFile lckfile ""
+       writeFile (fromRawFilePath lckfile) ""
        void $ lockExclusive lckfile
 #endif
 
index 96ca8fee3afd89b25aa2844f3f51e5d6deda310f..a344855665afe82ed8ac0a484f6a991191ff6aa7 100644 (file)
@@ -208,3 +208,5 @@ Annex -- my use case is more like local archiving and stuff. Git Annex does give
 my backup files around and it's always nice to have an external checksum (I use MD5E w/Annex) recorded
 "in the system" so that you can be sure your files are not altered due to bit rot, etc. In any case,
 big thanks go to Joey (et al.) for this wonderful tool you made!
+
+> [[fixed|done]] --[[Joey]]