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.
This commit is contained in:
Joey Hess 2016-04-14 15:36:53 -04:00
parent 5cb7f590be
commit bd516af734
Failed to extract signature
4 changed files with 38 additions and 13 deletions

View file

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