Fix build on Windows
Thanks to bug reporter for the patch.
This commit is contained in:
parent
9cb250f7be
commit
4b739fc460
8 changed files with 11 additions and 8 deletions
|
@ -154,7 +154,7 @@ winLocker :: (LockFile -> IO (Maybe LockHandle)) -> ContentLocker
|
||||||
winLocker takelock _ (Just lockfile) = do
|
winLocker takelock _ (Just lockfile) = do
|
||||||
modifyContent lockfile $
|
modifyContent lockfile $
|
||||||
void $ liftIO $ tryIO $
|
void $ liftIO $ tryIO $
|
||||||
writeFile lockfile ""
|
writeFile (fromRawFilePath lockfile) ""
|
||||||
liftIO $ takelock lockfile
|
liftIO $ takelock lockfile
|
||||||
-- never reached; windows always uses a separate lock file
|
-- never reached; windows always uses a separate lock file
|
||||||
winLocker _ _ Nothing = return Nothing
|
winLocker _ _ Nothing = return Nothing
|
||||||
|
|
|
@ -115,7 +115,7 @@ inAnnexSafe key = inAnnex' (fromMaybe True) (Just False) go key
|
||||||
Nothing -> return is_locked
|
Nothing -> return is_locked
|
||||||
Just lockhandle -> do
|
Just lockhandle -> do
|
||||||
dropLock lockhandle
|
dropLock lockhandle
|
||||||
void $ tryIO $ removeWhenExistsWith removeLink lockfile
|
void $ tryIO $ removeWhenExistsWith removeLink (fromRawFilePath lockfile)
|
||||||
return is_unlocked
|
return is_unlocked
|
||||||
, return is_missing
|
, return is_missing
|
||||||
)
|
)
|
||||||
|
|
|
@ -102,7 +102,7 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
|
||||||
createAnnexDirectory (parentDir logfile)
|
createAnnexDirectory (parentDir logfile)
|
||||||
ifM (liftIO $ isNothing <$> getEnv flag)
|
ifM (liftIO $ isNothing <$> getEnv flag)
|
||||||
( liftIO $ withNullHandle $ \nullh -> do
|
( liftIO $ withNullHandle $ \nullh -> do
|
||||||
loghandle <- openLog logfile
|
loghandle <- openLog (fromRawFilePath logfile)
|
||||||
e <- getEnvironment
|
e <- getEnvironment
|
||||||
cmd <- programPath
|
cmd <- programPath
|
||||||
ps <- getArgs
|
ps <- getArgs
|
||||||
|
@ -115,7 +115,7 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
|
||||||
exitcode <- withCreateProcess p $ \_ _ _ pid ->
|
exitcode <- withCreateProcess p $ \_ _ _ pid ->
|
||||||
waitForProcess pid
|
waitForProcess pid
|
||||||
exitWith exitcode
|
exitWith exitcode
|
||||||
, start (Utility.Daemon.foreground (Just pidfile)) $
|
, start (Utility.Daemon.foreground (Just (fromRawFilePath pidfile))) $
|
||||||
case startbrowser of
|
case startbrowser of
|
||||||
Nothing -> Nothing
|
Nothing -> Nothing
|
||||||
Just a -> Just $ a Nothing Nothing
|
Just a -> Just $ a Nothing Nothing
|
||||||
|
|
|
@ -12,6 +12,7 @@ git-annex (8.20201117) UNRELEASED; urgency=medium
|
||||||
* Fix hang when an external special remote program exited but
|
* 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 stderr pipe to it was left open, due to a daemon having inherited
|
||||||
the file descriptor.
|
the file descriptor.
|
||||||
|
* Fix build on Windows.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 16 Nov 2020 09:38:32 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 16 Nov 2020 09:38:32 -0400
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ checkTransfer t = debugLocks $ do
|
||||||
v <- liftIO $ lockShared lck
|
v <- liftIO $ lockShared lck
|
||||||
liftIO $ case v of
|
liftIO $ case v of
|
||||||
Nothing -> catchDefaultIO Nothing $
|
Nothing -> catchDefaultIO Nothing $
|
||||||
readTransferInfoFile Nothing tfile
|
readTransferInfoFile Nothing (fromRawFilePath tfile)
|
||||||
Just lockhandle -> do
|
Just lockhandle -> do
|
||||||
dropLock lockhandle
|
dropLock lockhandle
|
||||||
cleanstale
|
cleanstale
|
||||||
|
|
|
@ -258,7 +258,7 @@ removeDirGeneric topdir dir = do
|
||||||
#ifdef mingw32_HOST_OS
|
#ifdef mingw32_HOST_OS
|
||||||
{- Windows needs the files inside the directory to be writable
|
{- Windows needs the files inside the directory to be writable
|
||||||
- before it can delete them. -}
|
- before it can delete them. -}
|
||||||
void $ tryIO $ mapM_ allowWrite =<< dirContents dir
|
void $ tryIO $ mapM_ (allowWrite . toRawFilePath) =<< dirContents dir
|
||||||
#endif
|
#endif
|
||||||
tryNonAsync (removeDirectoryRecursive dir) >>= \case
|
tryNonAsync (removeDirectoryRecursive dir) >>= \case
|
||||||
Right () -> return ()
|
Right () -> return ()
|
||||||
|
@ -446,7 +446,7 @@ retrieveExportWithContentIdentifierM dir loc cid dest mkkey p =
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
=<< getFdStatus fd
|
=<< getFdStatus fd
|
||||||
#else
|
#else
|
||||||
=<< getFileStatus f
|
=<< R.getFileStatus f
|
||||||
#endif
|
#endif
|
||||||
guardSameContentIdentifiers cont cid currcid
|
guardSameContentIdentifiers cont cid currcid
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ lockPidFile pidfile = do
|
||||||
pid <- getPID
|
pid <- getPID
|
||||||
writeFile pidfile (show pid)
|
writeFile pidfile (show pid)
|
||||||
lckfile <- winLockFile pid pidfile
|
lckfile <- winLockFile pid pidfile
|
||||||
writeFile lckfile ""
|
writeFile (fromRawFilePath lckfile) ""
|
||||||
void $ lockExclusive lckfile
|
void $ lockExclusive lckfile
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -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
|
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,
|
"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!
|
big thanks go to Joey (et al.) for this wonderful tool you made!
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue