That error is now rethrown on the client, so it will be displayed.
For example:
$ git-annex fsck x --fast --from AMS-dir
fsck x (special remote reports: directory /home/joey/tmp/bench2/dir is not accessible) failed
No protocol version check is needed. Because in order to talk to a
proxied special remote, the client has to be running the upcoming
git-annex release. Which has this fix in it.
tryNonAsync (Remote.checkPresent r k) >>= \case
Right True -> sendmessage SUCCESS
Right False -> sendmessage FAILURE
- Left err -> sendmessage (ERROR (show err))
+ Left err -> propagateerror err
go
Just (LOCKCONTENT _) -> do
-- Special remotes do not support locking content.
sendmessage m = liftIO $ atomically $ putTMVar ihdl (Right m)
sendbytestring b = liftIO $ atomically $ putTMVar ihdl (Left b)
+
+ propagateerror err = sendmessage $ ERROR $
+ "proxied special remote reports: " ++ show err
then net $ sendMessage (BYPASS bypass)
else return ()
-checkPresent :: Key -> Proto Bool
+checkPresent :: Key -> Proto (Either String Bool)
checkPresent key = do
net $ sendMessage (CHECKPRESENT key)
- checkSuccess
+ checkSuccess'
{- Locks content to prevent it from being dropped, while running an action.
-
return observeFailure
checkSuccess :: Proto Bool
-checkSuccess = do
+checkSuccess = either (const False) id <$> checkSuccess'
+
+checkSuccess' :: Proto (Either String Bool)
+checkSuccess' = do
ack <- net receiveMessage
case ack of
- Just SUCCESS -> return True
- Just FAILURE -> return False
+ Just SUCCESS -> return (Right True)
+ Just FAILURE -> return (Right False)
+ Just (ERROR err) -> return (Left err)
_ -> do
net $ sendMessage (ERROR "expected SUCCESS or FAILURE")
- return False
+ return (Right False)
checkSuccessPlus :: Proto (Maybe [UUID])
checkSuccessPlus =
{- Helpers for remotes using the git-annex P2P protocol.
-
- - Copyright 2016-2021 Joey Hess <id@joeyh.name>
+ - Copyright 2016-2024 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
import Types.NumCopies
import Annex.Verify
import Logs.Location
+import Utility.SafeOutput
import Control.Concurrent
when (u /= remoteuuid) $
logChange k u InfoMissing
-checkpresent :: ProtoRunner Bool -> Key -> Annex Bool
-checkpresent runner k = maybe remoteUnavail return =<< runner (P2P.checkPresent k)
+checkpresent :: ProtoRunner (Either String Bool) -> Key -> Annex Bool
+checkpresent runner k =
+ runner (P2P.checkPresent k)
+ >>= \case
+ Nothing -> remoteUnavail
+ Just (Right b) -> return b
+ Just (Left err) -> giveup (safeOutput err)
lock :: WithConn a c -> ProtoConnRunner c -> UUID -> Key -> (VerifiedCopy -> Annex a) -> Annex a
lock withconn connrunner u k callback = withconn $ \conn -> do