diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-02-06 14:39:27 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-02-06 14:39:27 -0400 |
commit | a33ccc14c09d51a1604b34a175e7938d37f29abf (patch) | |
tree | 70bf7eaaff82b8946fdc1233430ee3f3674398b0 | |
parent | 953fc5bf47183a61d93f406b288efcfe019403c7 (diff) |
glacier: Detect when the glacier command in PATH is the wrong one, from boto, rather than from glacier-cli, and refuse to use it, since the boto program fails to fail when passed parameters it does not understand.
-rw-r--r-- | Remote/Glacier.hs | 17 | ||||
-rw-r--r-- | debian/changelog | 9 | ||||
-rw-r--r-- | doc/bugs/glacier_fails_to_copy.mdwn | 3 | ||||
-rw-r--r-- | doc/bugs/glacier_fails_to_copy/comment_2_b0614f2e7417af733f54c9ff569b11b0._comment | 33 |
4 files changed, 60 insertions, 2 deletions
diff --git a/Remote/Glacier.hs b/Remote/Glacier.hs index bffe33be8..289008266 100644 --- a/Remote/Glacier.hs +++ b/Remote/Glacier.hs @@ -5,7 +5,7 @@ - Licensed under the GNU GPL version 3 or higher. -} -module Remote.Glacier (remote, jobList) where +module Remote.Glacier (remote, jobList, checkSaneGlacierCommand) where import qualified Data.Map as M import qualified Data.Text as T @@ -223,7 +223,9 @@ glacierParams c params = datacenter:params (M.lookup "datacenter" c) glacierEnv :: RemoteConfig -> UUID -> Annex (Maybe [(String, String)]) -glacierEnv c u = go =<< getRemoteCredPairFor "glacier" c creds +glacierEnv c u = do + liftIO checkSaneGlacierCommand + go =<< getRemoteCredPairFor "glacier" c creds where go Nothing = return Nothing go (Just (user, pass)) = do @@ -301,3 +303,14 @@ jobList r keys = go =<< glacierEnv (config r) (uuid r) | otherwise -> parse c rest parse c (_:rest) = parse c rest + +-- boto's version of glacier exits 0 when given a parameter it doesn't +-- understand. See https://github.com/boto/boto/issues/2942 +checkSaneGlacierCommand :: IO () +checkSaneGlacierCommand = + whenM ((Nothing /=) <$> catchMaybeIO shouldfail) $ + error wrongcmd + where + test = proc "glacier" ["--compatibility-test-git-annex"] + shouldfail = withQuietOutput createProcessSuccess test + wrongcmd = "The glacier program in PATH seems to be from boto, not glacier-cli. Cannot use this program." diff --git a/debian/changelog b/debian/changelog index 6f4084e3d..4cc7fb05b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +git-annex (5.20150206) UNRELEASED; urgency=medium + + * glacier: Detect when the glacier command in PATH is the wrong one, + from boto, rather than from glacier-cli, and refuse to use it, + since the boto program fails to fail when passed + parameters it does not understand. + + -- Joey Hess <id@joeyh.name> Fri, 06 Feb 2015 13:57:08 -0400 + git-annex (5.20150205) unstable; urgency=medium * info: Can now display info about a given uuid. diff --git a/doc/bugs/glacier_fails_to_copy.mdwn b/doc/bugs/glacier_fails_to_copy.mdwn index 4180695cf..3c6d95502 100644 --- a/doc/bugs/glacier_fails_to_copy.mdwn +++ b/doc/bugs/glacier_fails_to_copy.mdwn @@ -80,3 +80,6 @@ git-annex: copy: 230 failed # End of transcript or log. """]] + +> git-annex will now detect this misconfiguration and refuse to use it, so +> [[done]] --[[Joey]] diff --git a/doc/bugs/glacier_fails_to_copy/comment_2_b0614f2e7417af733f54c9ff569b11b0._comment b/doc/bugs/glacier_fails_to_copy/comment_2_b0614f2e7417af733f54c9ff569b11b0._comment new file mode 100644 index 000000000..6813ff9fc --- /dev/null +++ b/doc/bugs/glacier_fails_to_copy/comment_2_b0614f2e7417af733f54c9ff569b11b0._comment @@ -0,0 +1,33 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 2""" + date="2015-02-06T17:30:50Z" + content=""" +Since someone also mentioned this problem on IRC (I don't know if it was +you), I am wondering if this is an easy mistake to make. I guess so; you +installed boto from Arch's packages and it included a /usr/bin/glacier.. +Same could happen if using pip to install boto, I think. + +I don't want to support multiple different glacier interface programs. The +eventual plan is to move glacier support into git-annex, using a haskell +library. + +The other concerning thing is that git-annex seems to have reported that +some of the transfers succeeded. It seems, very unfortunately, that +the glacier command from boto exits 0 when given unsupported +parameters. So, git-annex will think a transfer succeeded, at least some of +the time (sometimes gpg notices that the encrypted output is not all +consumed). + +I think that the best fix will be to make glacier-cli install a +"glacier-cli" program. Then git-annex can run that instead of "glacier" and +will be much less likely to run into namespace pollution. + +I have filed 2 bug reports: + +* [boto's glacier should exit nonzero after displaying usage](https://github.com/boto/boto/issues/2942) +* [glacier-cli should provide a glacier-cli command](https://github.com/basak/glacier-cli/issues/30) + +I have also put a really ugly hack into git-annex to detect when the wrong +glacier is installed, and refuse to use it. +"""]] |