From: "Gustavo L. de M. Chaves" <gnust...@cpan.org>

On Windows, the external git commands are invoked using backticks by
Git::activestate_pipe::TIEHANDLE, but there was no attempt to properly
quote their arguments. This caused problems with all but the simplest
command invokations.

The arguments are now surrounded by quotes and internal quotes are
doubled. This is not a complete quoting solution but takes care of
some of the most common problems on Windows.

Signed-off-by: Gustavo L. de M. Chaves <gnust...@cpan.org>
---
 perl/Git.pm | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/perl/Git.pm b/perl/Git.pm
index ef3134b..42c3971 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -1398,12 +1398,10 @@ use strict;
 
 sub TIEHANDLE {
        my ($class, @params) = @_;
-       # FIXME: This is probably horrible idea and the thing will explode
-       # at the moment you give it arguments that require some quoting,
-       # but I have no ActiveState clue... --pasky
-       # Let's just hope ActiveState Perl does at least the quoting
-       # correctly.
-       my @data = qx{git @params};
+       # FIXME: The quoting done below is not completely right but it
+       # should take care of the most common cases.
+       my @escaped_params = map { "\"$_\"" } map { s/"/""/g; $_ } @params;
+       my @data = qx{git @escaped_params};
        bless { i => 0, data => \@data, exit => $? }, $class;
 }
 
-- 
1.7.12.464.g83379df.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to