Bugfix: fsck --from a ssh remote did not actually check that the content on the remote is not corrupted

Changing to the P2P protocol broke this, because preseedTmp copies
the local copy of the object to the temp file, and then the P2P transfer
sees the right length file and uses it as-is.

When git-annex-shell is too old and rsync is used, it did verify the
content, and when the local repo does not have the object it did verify the
content.
This commit is contained in:
Joey Hess 2021-02-10 13:29:12 -04:00
parent 6487a75d33
commit e24ddb8946
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 5 additions and 8 deletions

View file

@ -184,7 +184,7 @@ gen r u rc gc rs
, name = Git.repoDescribe r
, storeKey = copyToRemote new st
, retrieveKeyFile = copyFromRemote new st
, retrieveKeyFileCheap = copyFromRemoteCheap new st r
, retrieveKeyFileCheap = copyFromRemoteCheap st r
, retrievalSecurityPolicy = RetrievalAllKeysSecure
, removeKey = dropKey new st
, lockContent = Just (lockKey new st)
@ -635,9 +635,9 @@ copyFromRemote'' repo forcersync r st@(State connpool _ _ _ _) key file dest met
bracketIO noop (const cleanup) (const $ a feeder)
`onException` liftIO forcestop
copyFromRemoteCheap :: Remote -> State -> Git.Repo -> Maybe (Key -> AssociatedFile -> FilePath -> Annex ())
copyFromRemoteCheap :: State -> Git.Repo -> Maybe (Key -> AssociatedFile -> FilePath -> Annex ())
#ifndef mingw32_HOST_OS
copyFromRemoteCheap r st repo
copyFromRemoteCheap st repo
| not $ Git.repoIsUrl repo = Just $ \key _af file -> guardUsable repo (giveup "cannot access remote") $ do
gc <- getGitConfigFromState st
loc <- liftIO $ gitAnnexLocation key repo gc
@ -647,11 +647,6 @@ copyFromRemoteCheap r st repo
R.createSymbolicLink absloc (toRawFilePath file)
, giveup "remote does not contain key"
)
| Git.repoIsSsh repo = Just $ \key af file ->
ifM (Annex.Content.preseedTmp key file)
( void $ copyFromRemote' True r st key af file nullMeterUpdate
, giveup "cannot preseed rsync with existing content"
)
| otherwise = Nothing
#else
copyFromRemoteCheap _ _ _ = Nothing