aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--Annex/Init.hs6
-rw-r--r--debian/changelog3
-rw-r--r--doc/forum/git-annex_does_not_protect_files_on_NTFS-Fuse/comment_1_4aef65f680e4801eb110fefa1f947f02._comment11
3 files changed, 18 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 ()
diff --git a/debian/changelog b/debian/changelog
index 376d4b017..1d09603d7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/doc/forum/git-annex_does_not_protect_files_on_NTFS-Fuse/comment_1_4aef65f680e4801eb110fefa1f947f02._comment b/doc/forum/git-annex_does_not_protect_files_on_NTFS-Fuse/comment_1_4aef65f680e4801eb110fefa1f947f02._comment
new file mode 100644
index 000000000..039d23740
--- /dev/null
+++ b/doc/forum/git-annex_does_not_protect_files_on_NTFS-Fuse/comment_1_4aef65f680e4801eb110fefa1f947f02._comment
@@ -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.
+"""]]