summaryrefslogtreecommitdiff
path: root/Annex/Content.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-11-18 15:45:32 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-11-18 15:45:32 -0400
commit143dfbe071f6ee247b11897e1dcce84778cfe269 (patch)
tree6eaf28ab01af12f01f02a22540722450db041da7 /Annex/Content.hs
parent400d689b0dcdfc802c642ab7d09c25dabc5709ee (diff)
annex object file mode for core.sharedRepository
When core.sharedRepository is set, annex object files are not made mode 444, since that prevents a user other than the file owner from locking them. Instead, a mode such as 664 is used in this case.
Diffstat (limited to 'Annex/Content.hs')
-rw-r--r--Annex/Content.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 612a96a6b..289a4f1b3 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -699,18 +699,21 @@ preseedTmp key file = go =<< inAnnex key
)
)
-{- Blocks writing to an annexed file, and modifies file permissions to
- - allow reading it, per core.sharedRepository setting. -}
+{- Normally, blocks writing to an annexed file, and modifies file
+ - permissions to allow reading it.
+ -
+ - When core.sharedRepository is set, the write bits are not removed from
+ - the file, but instead the appropriate group write bits are set. This is
+ - necessary to let other users in the group lock the file.
+ -}
freezeContent :: FilePath -> Annex ()
freezeContent file = unlessM crippledFileSystem $
withShared go
where
go GroupShared = liftIO $ modifyFileMode file $
- removeModes writeModes .
- addModes [ownerReadMode, groupReadMode]
+ addModes [ownerReadMode, groupReadMode, ownerWriteMode, groupWriteMode]
go AllShared = liftIO $ modifyFileMode file $
- removeModes writeModes .
- addModes readModes
+ addModes (readModes ++ writeModes)
go _ = liftIO $ modifyFileMode file $
removeModes writeModes .
addModes [ownerReadMode]