Work around wget bug #784348 which could cause it to clobber git-annex symlinks when downloading from ftp.

This commit is contained in:
Joey Hess 2015-05-05 13:53:06 -04:00
parent 3d8cf16eec
commit 0b18228516
4 changed files with 35 additions and 4 deletions

View file

@ -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 = []

2
debian/changelog vendored
View file

@ -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

View file

@ -103,3 +103,5 @@ $
# End of transcript or log.
"""]]
> workaround in place; [[done]] --[[Joey]]

View file

@ -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.
"""]]