git-annex-shell: Ensure that received files can be read. Files transferred from some Android devices may have very broken permissions as received.

This commit is contained in:
Joey Hess 2013-05-06 17:30:57 -04:00
parent a0f6dab8de
commit adde00f4f3
3 changed files with 18 additions and 8 deletions

View file

@ -470,9 +470,8 @@ preseedTmp key file = go =<< inAnnex key
liftIO $ copyFileExternal s file
)
{- Blocks writing to an annexed file. The file is made unwritable
- to avoid accidental edits. core.sharedRepository may change
- who can read it. -}
{- Blocks writing to an annexed file, and modifies file permissions to
- allow reading it, per core.sharedRepository setting. -}
freezeContent :: FilePath -> Annex ()
freezeContent file = unlessM crippledFileSystem $
liftIO . go =<< fromRepo getSharedRepository
@ -483,7 +482,9 @@ freezeContent file = unlessM crippledFileSystem $
go AllShared = modifyFileMode file $
removeModes writeModes .
addModes readModes
go _ = preventWrite file
go _ = modifyFileMode file $
removeModes writeModes .
addModes [ownerReadMode]
{- Allows writing to an annexed file that freezeContent was called on
- before. -}