On Thu, Jul 31, 2008 at 2:50 PM, Allan McRae <allan@archlinux.org> wrote:
Indeed, that is the first problem, netfile should be quoted here. local proto=$(echo "$netfile" | sed 's|://.*||')
And that $netfile should be $url....
Yeah, apparently.
But once this is fixed, we run into a second problem, with another sed command, which breaks because of all the & in the url. local dlcmd=$(echo "$dlagent" | sed "s|%o|$file.part|" | sed "s|%u|$netfile|"
$ netfile="ab&cd&ef"; echo "%u" | sed "s|%u|$netfile|" ab%ucd%uef
$ netfile="ab\&cd\&ef"; echo "%u" | sed "s|%u|$netfile|" ab&cd&ef
So I don't see how to fix this except manually escaping all & in the url...
Well, to just make the bug more obscure.
$ netfile="ab&cd&ef"; echo "%u" | sed "s|%u|$netfile|" | sed "s|\%u|\&|g" ab&cd&ef
But that makes problems if there is a %u in the url. But can we do some multistage hackery like that?
I really don't like this. I think we could use bash feature instead. echo ${netfile//foo/bar} But even after converting the two above sed rules with this, I still have other problem. It is driving me crazy. When I print the whole download command myself, and copy/paste it to the shell, it works fine. But when it gets executed in makepkg with : $(get_downloadcmd foo bar), it always fail.