[pacman-dev] [arch-dev-public] [signoff] pacman 3.2.0

Xavier shiningxc at gmail.com
Thu Jul 31 08:24:50 EDT 2008


On Thu, Jul 31, 2008 at 2:14 PM, Allan McRae <allan at archlinux.org> wrote:
>
> My hacked makepkg with:
>
> msg "ALLAN!: $netfile"
>    local proto=$(echo $netfile | sed 's|://.*||')
> msg "ALLAN!: $proto"
> sleep 5
>
> outputs this:
> ==> ALLAN!:
> http://www.mythtv.org/modules.php?name=Downloads&d_op=getit&lid=136&foo=/mythplugins-0.21.tar.bz2
> ==> ALLAN!:
>
> So it is that sed line that is failing
>

Indeed, that is the first problem, netfile should be quoted here.
local proto=$(echo "$netfile" | sed 's|://.*||')

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




More information about the pacman-dev mailing list