From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH OSSTEST v7 01/15] TestSupport: Add helper to fetch a URL on a host Date: Mon, 6 Jul 2015 17:24:21 +0100 Message-ID: <1436199861.25646.133.camel@citrix.com> References: <1432734277.14664.229.camel@citrix.com> <1432734323-14128-1-git-send-email-ian.campbell@citrix.com> <21914.38199.776194.101851@mariner.uk.xensource.com> <1436195001.25646.111.camel@citrix.com> <21914.42484.338354.551520@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <21914.42484.338354.551520@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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, < + $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.