[pacman-dev] [arch-dev-public] [signoff] pacman 3.2.0
Allan McRae
allan at archlinux.org
Thu Jul 31 08:50:39 EDT 2008
Xavier wrote:
> 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|://.*||')
>
>
And that $netfile should be $url....
> 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?
Allan
More information about the pacman-dev
mailing list