diff options
-rw-r--r-- | Annex/Init.hs | 30 | ||||
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | Test.hs | 2 | ||||
-rw-r--r-- | doc/bugs/Git-annex_not_properly_detecting_symlink_capability_in_CryFS.mdwn | 1 | ||||
-rw-r--r-- | doc/bugs/Git-annex_not_properly_detecting_symlink_capability_in_CryFS/comment_1_78f6f047578974df0dd73740ab05ee8c._comment | 17 |
5 files changed, 40 insertions, 12 deletions
diff --git a/Annex/Init.hs b/Annex/Init.hs index 53fbe35f2..aec926ecf 100644 --- a/Annex/Init.hs +++ b/Annex/Init.hs @@ -146,32 +146,40 @@ probeCrippledFileSystem :: Annex Bool probeCrippledFileSystem = do tmp <- fromRepo gitAnnexTmpMiscDir createAnnexDirectory tmp - liftIO $ probeCrippledFileSystem' tmp + probeCrippledFileSystem' tmp -probeCrippledFileSystem' :: FilePath -> IO Bool +probeCrippledFileSystem' :: FilePath -> Annex Bool #ifdef mingw32_HOST_OS probeCrippledFileSystem' _ = return True #else probeCrippledFileSystem' tmp = do let f = tmp </> "gaprobe" - writeFile f "" + liftIO $ writeFile f "" uncrippled <- probe f - void $ tryIO $ allowWrite f - removeFile f + void $ liftIO $ tryIO $ allowWrite f + liftIO $ removeFile f return $ not uncrippled where probe f = catchBoolIO $ do let f2 = f ++ "2" - nukeFile f2 - createSymbolicLink f f2 - nukeFile f2 - preventWrite f + liftIO $ nukeFile f2 + liftIO $ createSymbolicLink f f2 + liftIO $ nukeFile f2 + liftIO $ preventWrite f -- Should be unable to write to the file, unless -- running as root, but some crippled -- filesystems ignore write bit removals. - ifM ((== 0) <$> getRealUserID) + ifM ((== 0) <$> liftIO getRealUserID) ( return True - , not <$> catchBoolIO (writeFile f "2" >> return True) + , do + r <- liftIO $ catchBoolIO $ + 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 + ) #endif @@ -1,6 +1,8 @@ git-annex (6.20170819) UNRELEASED; urgency=medium * Support building with feed-1.0, while still supporting older versions. + * init: Display an additional message when it detects a filesystem that + allows writing to files whose write bit is not set. -- Joey Hess <id@joeyh.name> Mon, 28 Aug 2017 12:20:59 -0400 @@ -147,7 +147,7 @@ runner = Just go exitWith exitcode runsubprocesstests opts (Just _) = isolateGitConfig $ do ensuretmpdir - crippledfilesystem <- Annex.Init.probeCrippledFileSystem' tmpdir + crippledfilesystem <- annexeval $ Annex.Init.probeCrippledFileSystem' tmpdir case tryIngredients ingredients (tastyOptionSet opts) (tests crippledfilesystem opts) of Nothing -> error "No tests found!?" Just act -> ifM act diff --git a/doc/bugs/Git-annex_not_properly_detecting_symlink_capability_in_CryFS.mdwn b/doc/bugs/Git-annex_not_properly_detecting_symlink_capability_in_CryFS.mdwn index ca0131432..bb6280228 100644 --- a/doc/bugs/Git-annex_not_properly_detecting_symlink_capability_in_CryFS.mdwn +++ b/doc/bugs/Git-annex_not_properly_detecting_symlink_capability_in_CryFS.mdwn @@ -60,3 +60,4 @@ git-annex-6.20170519-1.fc26.x86_64 I love git-annex. +> [[done]] --[[Joey]] diff --git a/doc/bugs/Git-annex_not_properly_detecting_symlink_capability_in_CryFS/comment_1_78f6f047578974df0dd73740ab05ee8c._comment b/doc/bugs/Git-annex_not_properly_detecting_symlink_capability_in_CryFS/comment_1_78f6f047578974df0dd73740ab05ee8c._comment new file mode 100644 index 000000000..dae2a9d09 --- /dev/null +++ b/doc/bugs/Git-annex_not_properly_detecting_symlink_capability_in_CryFS/comment_1_78f6f047578974df0dd73740ab05ee8c._comment @@ -0,0 +1,17 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2017-08-28T17:06:35Z" + content=""" +git-annex has detected problems with the filesystem, since symlinks +work I think it detected that the filesystem allows writing to a +file even when the file's write bit is not set. + +In that situation, a git-annex repository using symlinks will apprear to +work, but if you have an annexed file "foo" in there, and run "echo hi > +foo", it will follow the symlink, and overwrite the annexed file, ignoring +the lack of write bit. This can result in data loss in an unexpected way, +which is why git-annex avoids using the symlinks in this situation. + +I've added an additional message to make more clear what is happening. +"""]] |