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.

This commit is contained in:
Joey Hess 2015-07-30 14:06:17 -04:00
parent 267f397d82
commit b30324fec7
3 changed files with 18 additions and 2 deletions

View file

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

3
debian/changelog vendored
View file

@ -6,6 +6,9 @@ git-annex (5.20150728) UNRELEASED; urgency=medium
* The last release accidentially removed a number of options from the
copy command. (-J, file matching options, etc). These have been added
back.
* 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.
-- Joey Hess <id@joeyh.name> Mon, 27 Jul 2015 15:57:07 -0400

View file

@ -0,0 +1,11 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2015-07-30T17:54:11Z"
content="""
Good idea. Also, putting an indirect mode repo on a NTFS filesystem would
probably yield confusing results when trying to use it on windows..
I've put a check for this in with the other crippled FS checks that init
does.
"""]]