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

@ -44,13 +44,19 @@ start key = ifM (inAnnex key)
go tmp = do
opts <- filterRsyncSafeOptions . maybe [] words
<$> getField "RsyncOptions"
ifM (liftIO $ rsyncServerReceive (map Param opts) tmp)
( ifM (isJust <$> Fields.getField Fields.direct)
ok <- liftIO $ rsyncServerReceive (map Param opts) tmp
-- The file could have been received with permissions that
-- do not allow reading it, so this is done before the
-- directcheck.
freezeContent tmp
if ok
then ifM (isJust <$> Fields.getField Fields.direct)
( directcheck tmp
, return True
)
, return False
)
else return False
{- If the sending repository uses direct mode, the file
- it sends could be modified as it's sending it. So check
- that the right size file was received, and that the key/value