Xavier wrote: > On Thu, Jul 31, 2008 at 2:14 PM, Allan McRae <[EMAIL PROTECTED]> 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 _______________________________________________ pacman-dev mailing list [email protected] http://archlinux.org/mailman/listinfo/pacman-dev
