[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: John Peacock <jpeacock_at_rowman.com>
Date: 2005-07-27 13:01:38 CEST

Martin Tomes wrote:
> Michael W Thelen wrote:
>> Would it be
>> better to guard the parameters inside the SVNCall subroutine itself,
>> with something like this?

Definitely the right idea; I *was* going to say wrong technique, but it's really
harmless to quote all of the options (under every shell that I am aware of). If
you wanted to be parsimonious about quoting you could use something like this:

=== contrib/client-side/svncopy.pl.in
==================================================================
--- contrib/client-side/svncopy.pl.in (revision 15015)
+++ contrib/client-side/svncopy.pl.in (local)
@@ -686,7 +686,8 @@
  {
    my ( $command, @options ) = @_;

- my @commandline = ( $svn, $command, @svn_options, @options );
+ my @commandline = ( $svn, $command, @svn_options,
+ map { /\s/ ? "\"$_\"" : $_ } @options );

    info( " > ", join( " ", @commandline ), "\n" );

which will wrap quotes around only those elements of @options which contain
embedded whitespace. You could probably assume that the only whitespace is the
space character itself, but I would rather quote a tab/newline and have the exec
fail with a useful error message than not quote it and have it go off into
neverland.

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jul 27 13:02:18 2005

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