fix nested exception bug

Fix reversion introduced in version 6.20180316 that caused git-annex to
stop processing files when unable to contact a ssh remote.

The bug was not in any of the changed lines, but this one in inAnnex:

P2PHelper.checkpresent (Ssh.runProto rmt connpool (cantCheck rmt) fallback) key

cantCheck throws an exception, but that parameter to runProto expects a
value, which it returns. So, inAnnex is returning a Bool containing an
exception. This defeats the usual checks for checkPresent throwing an
exception, crashing git-annex.

Fixed by making runProto take an `Annex a` instead of an `a`, so
passing cantCheck to it doesn't nest exceptions.

This commit was sponsored by andrea rota.
This commit is contained in:
Joey Hess 2018-07-03 13:09:04 -04:00
parent edd257dcfb
commit 9f3a346f25
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 19 additions and 6 deletions

View file

@ -395,7 +395,7 @@ dropKey' repo r (State connpool duc _) key
| Git.repoIsHttp repo = giveup "dropping from http remote not supported"
| otherwise = commitOnCleanup repo r $ do
let fallback = Ssh.dropKey repo key
P2PHelper.remove (Ssh.runProto r connpool False fallback) key
P2PHelper.remove (Ssh.runProto r connpool (return False) fallback) key
lockKey :: Remote -> State -> Key -> (VerifiedCopy -> Annex r) -> Annex r
lockKey r st key callback = do
@ -493,7 +493,7 @@ copyFromRemote'' repo forcersync r (State connpool _ _) key file dest meterupdat
| Git.repoIsSsh repo = if forcersync
then fallback meterupdate
else P2PHelper.retrieve
(\p -> Ssh.runProto r connpool (False, UnVerified) (fallback p))
(\p -> Ssh.runProto r connpool (return (False, UnVerified)) (fallback p))
key file dest meterupdate
| otherwise = giveup "copying from non-ssh, non-http remote not supported"
where
@ -605,7 +605,7 @@ copyToRemote' repo r (State connpool duc _) key file meterupdate
)
| Git.repoIsSsh repo = commitOnCleanup repo r $
P2PHelper.store
(\p -> Ssh.runProto r connpool False (copyremotefallback p))
(\p -> Ssh.runProto r connpool (return False) (copyremotefallback p))
key file meterupdate
| otherwise = giveup "copying to non-ssh repo not supported"