summaryrefslogtreecommitdiff
path: root/Command/Fsck.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-04-14 15:36:53 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-04-14 15:36:53 -0400
commitca1518ed7f714a725fe9811716a320f1dc0b2f22 (patch)
tree769700bb4b221f1d5275f8d82623c84fd6accd66 /Command/Fsck.hs
parent2a74e12d24a91db4e23d274a6ce8c14a3490a8fa (diff)
fsck: Warn when core.sharedRepository is set and an annex object file's write bit is not set and cannot be set due to the file being owned by a different user.
Made all Annex.Perms file mode changing functions ignore errors when core.sharedRepository is set, because the file might be owned by someone else. I don't fancy getting bug reports about crashes due to set modes in this configuration, which is a very foot-shooty configuration in the first place. The fsck warning is necessary because old repos kept files mode 444, which doesn't allow locking them, and so if the mode remains 444 due to the file being owned by someone else, the user should be told about it.
Diffstat (limited to 'Command/Fsck.hs')
-rw-r--r--Command/Fsck.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index 81618600f..0136175c7 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -223,10 +223,12 @@ verifyLocationLog key keystatus desc = do
{- Since we're checking that a key's object file is present, throw
- in a permission fixup here too. -}
- when (present && not direct) $ void $ tryIO $
- if isKeyUnlocked keystatus
+ when (present && not direct) $ do
+ void $ tryIO $ if isKeyUnlocked keystatus
then thawContent obj
else freezeContent obj
+ unlessM (isContentWritePermOk obj) $
+ warning $ "** Unable to set correct write mode for " ++ obj ++ " ; perhaps you don't own that file"
whenM (liftIO $ doesDirectoryExist $ parentDir obj) $
freezeContentDir obj