diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-09-29 14:58:23 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-09-29 15:08:18 -0400 |
commit | 49ea9c99164e052dc0c66750c822d350d62a547e (patch) | |
tree | 896909e90ebd21deca6b2d8359dae9c188e28d35 /Annex | |
parent | ab1ff5b7f3e558e0277edccf46cf9c9e5c0675e1 (diff) |
test: Fix reversion that made it only run inside a git repository.
Using annexeval to run probeCrippledFileSystem' caused Git.CurrentRepo.get
to be run. Fixed easily since probeCrippledFileSystem' had no need to use
the Annex monad.
This commit was sponsored by Ethan Aubin.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Init.hs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Annex/Init.hs b/Annex/Init.hs index aec926ecf..9a284e62b 100644 --- a/Annex/Init.hs +++ b/Annex/Init.hs @@ -146,40 +146,40 @@ probeCrippledFileSystem :: Annex Bool probeCrippledFileSystem = do tmp <- fromRepo gitAnnexTmpMiscDir createAnnexDirectory tmp - probeCrippledFileSystem' tmp + (r, warnings) <- liftIO $ probeCrippledFileSystem' tmp + mapM_ warning warnings + return r -probeCrippledFileSystem' :: FilePath -> Annex Bool +probeCrippledFileSystem' :: FilePath -> IO (Bool, [String]) #ifdef mingw32_HOST_OS probeCrippledFileSystem' _ = return True #else probeCrippledFileSystem' tmp = do let f = tmp </> "gaprobe" - liftIO $ writeFile f "" - uncrippled <- probe f - void $ liftIO $ tryIO $ allowWrite f - liftIO $ removeFile f - return $ not uncrippled + writeFile f "" + r <- probe f + void $ tryIO $ allowWrite f + removeFile f + return r where - probe f = catchBoolIO $ do + probe f = catchDefaultIO (True, []) $ do let f2 = f ++ "2" - liftIO $ nukeFile f2 - liftIO $ createSymbolicLink f f2 - liftIO $ nukeFile f2 - liftIO $ preventWrite f + nukeFile f2 + createSymbolicLink f f2 + nukeFile f2 + preventWrite f -- Should be unable to write to the file, unless -- running as root, but some crippled -- filesystems ignore write bit removals. - ifM ((== 0) <$> liftIO getRealUserID) - ( return True + ifM ((== 0) <$> getRealUserID) + ( return (False, []) , do - r <- liftIO $ catchBoolIO $ - writeFile f "2" >> return True + r <- catchBoolIO $ do + writeFile f "2" + return True if r - then do - warning "Filesystem allows writing to files whose write bit is not set." - return False - else return True - + then return (True, ["Filesystem allows writing to files whose write bit is not set."]) + else return (False, []) ) #endif |