aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Utility/Url.hs16
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn2
-rw-r--r--doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__/comment_1_dca81d5db9a966fc992ed28bb3c2a242._comment19
4 files changed, 35 insertions, 4 deletions
diff --git a/Utility/Url.hs b/Utility/Url.hs
index 1b0c394b7..9c5d6a708 100644
--- a/Utility/Url.hs
+++ b/Utility/Url.hs
@@ -25,6 +25,9 @@ module Utility.Url (
) where
import Common
+import Utility.Tmp
+import qualified Build.SysConfig
+
import Network.URI
import Network.HTTP.Conduit
import Network.HTTP.Types
@@ -32,8 +35,6 @@ import qualified Data.CaseInsensitive as CI
import qualified Data.ByteString as B
import qualified Data.ByteString.UTF8 as B8
-import qualified Build.SysConfig
-
type URLString = String
type Headers = [String]
@@ -242,8 +243,15 @@ download' quiet url file uo = do
writeFile file ""
go "curl" $ headerparams ++ quietopt "-s" ++
[Params "-f -L -C - -# -o"]
- go cmd opts = boolSystem cmd $
- addUserAgent uo $ reqParams uo++opts++[File file, File url]
+
+ {- Run wget in a temp directory because it has been buggy
+ - and overwritten files in the current directory, even though
+ - it was asked to write to a file elsewhere. -}
+ go cmd opts = withTmpDir "downloadurl" $ \tmp -> do
+ relfile <- relPathDirToFile tmp file
+ let ps = addUserAgent uo $ reqParams uo++opts++[File relfile, File url]
+ boolSystem' cmd ps $ \p -> p { cwd = Just tmp }
+
quietopt s
| quiet = [Param s]
| otherwise = []
diff --git a/debian/changelog b/debian/changelog
index 82243d93d..d7efa4228 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,8 @@ git-annex (5.20150421) UNRELEASED; urgency=medium
the end.
* assistant: Added --autostop to complement --autostart.
* Android: Updated bundled ssh from 6.1p1 to 6.4p1.
+ * Work around wget bug #784348 which could cause it to clobber git-annex
+ symlinks when downloading from ftp.
-- Joey Hess <id@joeyh.name> Tue, 21 Apr 2015 15:54:10 -0400
diff --git a/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn b/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn
index 0c9755385..d9ab7670d 100644
--- a/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn
+++ b/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn
@@ -103,3 +103,5 @@ $
# End of transcript or log.
"""]]
+
+> workaround in place; [[done]] --[[Joey]]
diff --git a/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__/comment_1_dca81d5db9a966fc992ed28bb3c2a242._comment b/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__/comment_1_dca81d5db9a966fc992ed28bb3c2a242._comment
new file mode 100644
index 000000000..65ebab1f2
--- /dev/null
+++ b/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__/comment_1_dca81d5db9a966fc992ed28bb3c2a242._comment
@@ -0,0 +1,19 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2015-05-05T17:11:38Z"
+ content="""
+Thanks for a great bug report!
+
+Unfortunately, this turns out to be a bug in wget, as shown by this transcript:
+
+ joey@darkstar:~/tmp/y>ls
+ README@
+ joey@darkstar:~/tmp/y>wget -q --show-progress --clobber -c -O .git/annex/tmp/SHA256E-s1495--8822780b87a880ca9956ac108812557044618859cecb07df488df57e8134e34f ftp://ftp.funet.fi/pub/Linux/mirrors/debian/README --user-agent git-annex/5.20150505-gcdb212f
+ joey@darkstar:~/tmp/y>ls
+ joey@darkstar:~/tmp/y>
+
+I have filed a bug report on wget <http://bugs.debian.org/784348>,
+and I guess I'll try to work around it in git-annex by running wget
+inside an empty temp directory.
+"""]]