Fix build on Windows

Thanks to bug reporter for the patch.
This commit is contained in:
Joey Hess 2020-11-19 12:33:00 -04:00
parent 9cb250f7be
commit 4b739fc460
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
8 changed files with 11 additions and 8 deletions

View 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

View 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
)

View 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

View file

@ -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

View 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

View 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

View 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

View 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]]