[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] svncopy.pl fails with spaces in file paths.

From: Charles Bailey <bailey.charles_at_gmail.com>
Date: 2005-08-09 22:33:19 CEST

On 8/9/05, Michael W Thelen <mike@pietdepsi.com> wrote:
> Michael W Thelen wrote:
> > Charles Bailey wrote:
> >
> >>On 8/9/05, Michael W Thelen <mike@pietdepsi.com> wrote:
> >>
> >>
> >>>- my @commandline = ( $svn, $command, @svn_options, @options );
> >>>+ my @commandline = ( $svn, $command, @svn_options, map {"\"$_\""}
> >>>@options );
> >>
> >>Would you do better by using quotemeta() rather than plain quotes?
> >
> > I don't think so, since we're not trying to quote regular expression
> > special characters, and quotemeta doesn't escape spaces.
>
> Um, whoops. Apparently my Perl is a little rusty. Ignore that last
> message. :-) You may be right, quotemeta may be the better solution.

I can see two potential issues:

1. Using quotemeta makes a stronger assumption than just "" that the
command line interpreter will honor Bourne-shell-like quoting
(specifically, that \x reduces to x for all x not in [A-Za-z0-9]).
Since SVNCall already assumes Bourne-shell-like I/O redirection, I
don't think this is much of a problem, but it may trip over some
partially-Bourne-compatible foosh.

2. As a subproblem of 1, it assumes that \x reduces to x for any
locale-specific character x. Again, I don't think this is a problem
for bash and kin, but I don't have the experience of some other list
members with non-C locales. (The locale-friendly way to approach this
problem is s-(\W)-\\$1-g, but that's less secure against shell
metacharacters, of course.)

Overall, I think quotemeta works, unless there's a command line
interpreter with which I'm not acquainted that'll barf on \$ or
somesuch.

-- 
Regards,
Charles Bailey
Lists: bailey _dot_ charles _at_ gmail _dot_ com
Other: bailey _at_ newman _dot_ upenn _dot_ edu
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Aug 9 22:34:40 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.