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

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

From: Michael W Thelen <mike_at_pietdepsi.com>
Date: 2005-08-09 20:47:52 CEST

Michael W Thelen wrote:
> John Peacock 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:
> Yep, I decided to quote all options for simplicity, and since we're
> depending on the shell to do the right thing with quotes anyway.
> Actually, I thought about quoting everything in @commandline, but I
> noticed that only @options depends on input from the user -- everything
> else is under the script's direct control.
> Either implementation should work fine. I think I prefer to quote
> everything since it is simpler code to read, though.

It looks like nothing ever happened with this patch... is it all right
if I commit this change? (I'm not sure how to assign credit for the
patch, review, etc. since Martin wrote the original patch and this one
is different but accomplishes the same goal.)

Surround command-line arguments with quotes when calling svn via the
shell, so arguments with spaces are handled correctly.

Patch by: Martin Tomes <lists@tomes.org>
Review by: John Peacock <jpeacock@rowman.com>

* contrib/client-side/svncopy.pl.in
  (SVNCall): Surround user-generated command-line options with quotes so
    they are correctly interpreted by the shell.

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

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

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

Michael W Thelen
It is a mistake to think you can solve any major problems just with
potatoes.       -- Douglas Adams
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Aug 9 20:49:02 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.