[pacman-dev] makepkg download fails with special chars in URL (was: [signoff] pacman 3.2.0)

Xavier shiningxc at gmail.com
Thu Jul 31 15:53:44 EDT 2008


On Thu, Jul 31, 2008 at 5:27 PM, Allan McRae <allan at archlinux.org> wrote:
> This is where I have got up to in searching for the solution:
>
> 1) Fix sed statement to extract protocol in get_downloadclient()
>    local proto=$(echo "$url" | sed 's|://.*||')
>

Fine

> 2) escape ampersands in netfile in get_downloadcmd()
>    local netfile=$(echo "$2" | sed "s|\&|\\\&|g")
>

I wanted to try using bash substitution instead of sed for replacing %u and %o
                dlcmd=${dlagent//%o/$file.part}
                dlcmd=${dlcmd//%u/$netfile}

But then, netfile still needs to be quoted, so
                dlcmd=${dlagent//%o/$file.part}
                dlcmd=${dlcmd//%u/\"$netfile\"}

And just doing this breaks the whole vim syntax highlighting, which is
very very annoying.

> Then $dlcmd get created correctly but running the following messages at
> the end of get_downloadcmd() shows what is happening...
>
> plain "$dlcmd"
> /usr/bin/wget -c -t 3 --waitretry=3 -O mythplugins-0.21.tar.bz2.part
> http://www.mythtv.org/modules.php?name=Downloads&d_op=getit&lid=136&foo=/mythplugins-0.21.tar.bz2
>
> plain "$(echo $dlcmd)"
> /usr/bin/wget -c -t 3 --waitretry=3 -O mythplugins-0.21.tar.bz2.part
>
> So this does not pass the url to the actual wget call, which explains
> the "wget: missing URL" error message I am left with.  Note that once
> that is fixed, the ampersands in the url need escaped again for the wget
> command to actually work.
>
> I need sleep so I leave it to people in a more appropriate time zones to
> find a solution. :)

I got stuck on exactly the same issue, I just spent at least one hour
on it for nothing, it really pissed me off.
Now I need sleep so I leave it to people in a more appropriate time zones to
find a solution. :) (hello Dan :D)

More seriously, I don't consider this a huge issue. The biggest issue
here in my opinion is these fucked up urls, I really hate them.
I can't stand urls that are not easy to read, write and remember, and
that cause a ton of stupid issues like this.




More information about the pacman-dev mailing list