fix numerous problem with test suite on crippled filesystems etc

This commit is contained in:
Joey Hess 2016-02-16 15:30:59 -04:00
parent 15148ee9eb
commit aa569500d5
Failed to extract signature
2 changed files with 61 additions and 39 deletions

View file

@ -14,6 +14,7 @@ module Annex.Init (
initialize',
uninitialize,
probeCrippledFileSystem,
probeCrippledFileSystem',
) where
import Annex.Common
@ -134,16 +135,20 @@ isBare = fromRepo Git.repoIsLocalBare
- or removing write access from files. -}
probeCrippledFileSystem :: Annex Bool
probeCrippledFileSystem = do
tmp <- fromRepo gitAnnexTmpMiscDir
createAnnexDirectory tmp
liftIO $ probeCrippledFileSystem' tmp
probeCrippledFileSystem' :: FilePath -> IO Bool
probeCrippledFileSystem' tmp = do
#ifdef mingw32_HOST_OS
return True
#else
tmp <- fromRepo gitAnnexTmpMiscDir
let f = tmp </> "gaprobe"
createAnnexDirectory tmp
liftIO $ writeFile f ""
uncrippled <- liftIO $ probe f
void $ liftIO $ tryIO $ allowWrite f
liftIO $ removeFile f
writeFile f ""
uncrippled <- probe f
void $ tryIO $ allowWrite f
removeFile f
return $ not uncrippled
where
probe f = catchBoolIO $ do