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:
parent
a0f6dab8de
commit
adde00f4f3
3 changed files with 18 additions and 8 deletions
|
@ -470,9 +470,8 @@ preseedTmp key file = go =<< inAnnex key
|
||||||
liftIO $ copyFileExternal s file
|
liftIO $ copyFileExternal s file
|
||||||
)
|
)
|
||||||
|
|
||||||
{- Blocks writing to an annexed file. The file is made unwritable
|
{- Blocks writing to an annexed file, and modifies file permissions to
|
||||||
- to avoid accidental edits. core.sharedRepository may change
|
- allow reading it, per core.sharedRepository setting. -}
|
||||||
- who can read it. -}
|
|
||||||
freezeContent :: FilePath -> Annex ()
|
freezeContent :: FilePath -> Annex ()
|
||||||
freezeContent file = unlessM crippledFileSystem $
|
freezeContent file = unlessM crippledFileSystem $
|
||||||
liftIO . go =<< fromRepo getSharedRepository
|
liftIO . go =<< fromRepo getSharedRepository
|
||||||
|
@ -483,7 +482,9 @@ freezeContent file = unlessM crippledFileSystem $
|
||||||
go AllShared = modifyFileMode file $
|
go AllShared = modifyFileMode file $
|
||||||
removeModes writeModes .
|
removeModes writeModes .
|
||||||
addModes readModes
|
addModes readModes
|
||||||
go _ = preventWrite file
|
go _ = modifyFileMode file $
|
||||||
|
removeModes writeModes .
|
||||||
|
addModes [ownerReadMode]
|
||||||
|
|
||||||
{- Allows writing to an annexed file that freezeContent was called on
|
{- Allows writing to an annexed file that freezeContent was called on
|
||||||
- before. -}
|
- before. -}
|
||||||
|
|
|
@ -44,13 +44,19 @@ start key = ifM (inAnnex key)
|
||||||
go tmp = do
|
go tmp = do
|
||||||
opts <- filterRsyncSafeOptions . maybe [] words
|
opts <- filterRsyncSafeOptions . maybe [] words
|
||||||
<$> getField "RsyncOptions"
|
<$> getField "RsyncOptions"
|
||||||
ifM (liftIO $ rsyncServerReceive (map Param opts) tmp)
|
ok <- liftIO $ rsyncServerReceive (map Param opts) tmp
|
||||||
( ifM (isJust <$> Fields.getField Fields.direct)
|
|
||||||
|
-- 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
|
( directcheck tmp
|
||||||
, return True
|
, return True
|
||||||
)
|
)
|
||||||
, return False
|
else return False
|
||||||
)
|
|
||||||
{- If the sending repository uses direct mode, the file
|
{- If the sending repository uses direct mode, the file
|
||||||
- it sends could be modified as it's sending it. So check
|
- it sends could be modified as it's sending it. So check
|
||||||
- that the right size file was received, and that the key/value
|
- that the right size file was received, and that the key/value
|
||||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -12,6 +12,9 @@ git-annex (4.20130502) UNRELEASED; urgency=low
|
||||||
* direct: Fix a bug that could cause some files to be left in indirect mode.
|
* direct: Fix a bug that could cause some files to be left in indirect mode.
|
||||||
* When initializing a directory special remote with a relative path,
|
* When initializing a directory special remote with a relative path,
|
||||||
the path is made absolute.
|
the path is made absolute.
|
||||||
|
* git-annex-shell: Ensure that received files can be read. Files
|
||||||
|
transferred from some Android devices may have very broken permissions
|
||||||
|
as received.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Thu, 02 May 2013 20:39:19 -0400
|
-- Joey Hess <joeyh@debian.org> Thu, 02 May 2013 20:39:19 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue