external crash fixes
When the external special remote program crashed, a newline could be output, which messed up the expected output for --batch mode. Avoid checking EXPORTSUPPORTED for special remotes that are not configured to use exports. The datalad special remote apparently is/was buggy and crashed on EXPORTSUPPORTED. Anyway, there's no need to send it when the configuration doesn't need it. This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
parent
e8c9a5c515
commit
e9e5613e94
2 changed files with 12 additions and 4 deletions
|
@ -7,6 +7,10 @@ git-annex (6.20170926) UNRELEASED; urgency=medium
|
||||||
to avoid the user being surprised in cases where that behavior is not
|
to avoid the user being surprised in cases where that behavior is not
|
||||||
desired or expected.
|
desired or expected.
|
||||||
* sync: Added --cleanup, which removes local and remote synced/ branches.
|
* sync: Added --cleanup, which removes local and remote synced/ branches.
|
||||||
|
* external: When the external special remote program crashed, a newline
|
||||||
|
could be output, which messed up the expected output for --batch mode.
|
||||||
|
* external: Avoid checking EXPORTSUPPORTED for special remotes that are
|
||||||
|
not configured to use exports.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Thu, 28 Sep 2017 12:01:39 -0400
|
-- Joey Hess <id@joeyh.name> Thu, 28 Sep 2017 12:01:39 -0400
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import Git.Config (isTrue, boolConfig)
|
||||||
import Git.Env
|
import Git.Env
|
||||||
import Remote.Helper.Special
|
import Remote.Helper.Special
|
||||||
import Remote.Helper.Export
|
import Remote.Helper.Export
|
||||||
|
import Annex.Export
|
||||||
import Remote.Helper.ReadOnly
|
import Remote.Helper.ReadOnly
|
||||||
import Remote.Helper.Messages
|
import Remote.Helper.Messages
|
||||||
import Utility.Metered
|
import Utility.Metered
|
||||||
|
@ -69,7 +70,9 @@ gen r u c gc
|
||||||
Annex.addCleanup (RemoteCleanup u) $ stopExternal external
|
Annex.addCleanup (RemoteCleanup u) $ stopExternal external
|
||||||
cst <- getCost external r gc
|
cst <- getCost external r gc
|
||||||
avail <- getAvailability external r gc
|
avail <- getAvailability external r gc
|
||||||
exportsupported <- checkExportSupported' external
|
exportsupported <- if exportTree c
|
||||||
|
then checkExportSupported' external
|
||||||
|
else return False
|
||||||
let exportactions = if exportsupported
|
let exportactions = if exportsupported
|
||||||
then return $ ExportActions
|
then return $ ExportActions
|
||||||
{ storeExport = storeExportM external
|
{ storeExport = storeExportM external
|
||||||
|
@ -165,8 +168,9 @@ checkExportSupported c gc = do
|
||||||
=<< newExternal externaltype NoUUID c gc
|
=<< newExternal externaltype NoUUID c gc
|
||||||
|
|
||||||
checkExportSupported' :: External -> Annex Bool
|
checkExportSupported' :: External -> Annex Bool
|
||||||
checkExportSupported' external = safely $
|
checkExportSupported' external = go `catchNonAsync` (const (return False))
|
||||||
handleRequest external EXPORTSUPPORTED Nothing $ \resp -> case resp of
|
where
|
||||||
|
go = handleRequest external EXPORTSUPPORTED Nothing $ \resp -> case resp of
|
||||||
EXPORTSUPPORTED_SUCCESS -> Just $ return True
|
EXPORTSUPPORTED_SUCCESS -> Just $ return True
|
||||||
EXPORTSUPPORTED_FAILURE -> Just $ return False
|
EXPORTSUPPORTED_FAILURE -> Just $ return False
|
||||||
UNSUPPORTED_REQUEST -> Just $ return False
|
UNSUPPORTED_REQUEST -> Just $ return False
|
||||||
|
@ -313,7 +317,7 @@ safely a = go =<< tryNonAsync a
|
||||||
where
|
where
|
||||||
go (Right r) = return r
|
go (Right r) = return r
|
||||||
go (Left e) = do
|
go (Left e) = do
|
||||||
warning $ show e
|
toplevelWarning False (show e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
{- Sends a Request to the external remote, and waits for it to generate
|
{- Sends a Request to the external remote, and waits for it to generate
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue