[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH OSSTEST v7 01/15] TestSupport: Add helper to fetch a URL on a host



On Mon, 2015-07-06 at 16:59 +0100, Ian Jackson wrote:
> Ian Campbell writes ("Re: [PATCH OSSTEST v7 01/15] TestSupport: Add helper to 
> fetch a URL on a host"):
> > On Mon, 2015-07-06 at 15:48 +0100, Ian Jackson wrote:
> > > Ian Campbell writes ("[PATCH OSSTEST v7 01/15] TestSupport: Add helper to 
> > > fetch a URL on a host"):
> > > > +    $useproxy wget --progress=dot:mega -O \"$path\" \"$url\"
> ...
> > > \Q may be of some help.
> > 
> > Really? I thought that escaped things at the Perl level, is that
> > sufficient for the shell stuff within the Perl too?
> 
> If you wrote
> 
>   +    target_cmd_root($ho, <<END, $timeo);
>   +    $useproxy wget --progress=dot:mega -O \Q$path\E \Q$url\E
> 
> and $url contained
> 
>   http://chars $"'\ considered harmful.iso
> 
> then target_cmd_root would get
> 
>   http_proxy=something wget --progress=dot:mega -O \/some\/path \
>      http\:\/\/chars\ \$\"\'\\\ considered\ harmful\.iso

Interesting, I had assumed \Q...\E was some sort of lexer/parser level
thing, when actually it "just" rewrites what is between it.

And as it happens Perl and shell need a very similar set of things
quoting.

> 
> And:
> 
>   mariner:~> echo http\:\/\/chars\ \$\"\'\\\ considered\ harmful\.iso
>   http://chars $"'\ considered harmful.iso
>   mariner:~>
> 
> But maybe this is too ugly,

I think it is ok actually.

>  in which case you could use ''
> and some regexp like s/['\\]/'\\$&'/g (not tested).
> 
> Ian.



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.