summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-30 14:06:17 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-30 14:06:17 -0400
commit7bd95de97f84a139ba49c1f8a92d1fc5a22a0131 (patch)
treee60292a7d25ad3c13b4e0cbd1b108df8473f576d /Annex
parent6b35e3ef6c62aca612d2edcc25397076f4a674b2 (diff)
init: Detect when the filesystem is crippled such that it ignores attempts to remove the write bit from a file, and enable direct mode. Seen with eg, NTFS fuse on linux.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Init.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Annex/Init.hs b/Annex/Init.hs
index 2cc1c1897..fad533d13 100644
--- a/Annex/Init.hs
+++ b/Annex/Init.hs
@@ -128,6 +128,7 @@ probeCrippledFileSystem = do
createAnnexDirectory tmp
liftIO $ writeFile f ""
uncrippled <- liftIO $ probe f
+ void $ liftIO $ tryIO $ allowWrite f
liftIO $ removeFile f
return $ not uncrippled
where
@@ -137,8 +138,9 @@ probeCrippledFileSystem = do
createSymbolicLink f f2
nukeFile f2
preventWrite f
- allowWrite f
- return True
+ -- Should be unable to write to the file, but some crippled
+ -- filesystems ignore write bit removals.
+ not <$> catchBoolIO (writeFile f "2" >> return True)
#endif
checkCrippledFileSystem :: Annex ()