Skip to contentSkip to conversation

cvsimport: always pass user data to "system" as a list

PATCH In review Jeff King 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore

Jeff King

author
#0 lore raw

PATCH 1/1 cvsimport: always pass user data to "system" as a list

This avoids invoking the shell. Not only is it faster, but it prevents the possibility of interpreting our arguments in the shell.

---
Nigel reported a problem with a CVS branch that had '(' in the name. No report yet on whether this fixes it, but it should be done regardless.

I checked over git-cvsimport.perl, and this was the only instance I found.

 git-cvsimport.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-cvsimport.perl +1 -1
index 95c5eec..bdac5d5 100755
@@ -772,7 +772,7 @@ sub commit {
 	waitpid($pid,0);
 	die "Error running git-commit-tree: $?\n" if $?;
 
-	system("git-update-ref $remote/$branch $cid") == 0
+	system('git-update-ref', "$remote/$branch", $cid) == 0
 		or die "Cannot write branch $branch for update: $!\n";
 
 	if ($tag) {
Signature · 1 line
1.5.5.1.178.gc1eb9.dirty
#1 lore raw

This fixed my import problem - thanks for the swift identification (my perl isn't so hot so it scared me :) )

Quoted 32 lines · Jeff King

This avoids invoking the shell. Not only is it faster, but
it prevents the possibility of interpreting our arguments in the shell.

---
Nigel reported a problem with a CVS branch that had '(' in the name. No report yet on whether this fixes it, but it should be done regardless.

I checked over git-cvsimport.perl, and this was the only instance I found.

  git-cvsimport.perl |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 95c5eec..bdac5d5 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl

 @@ -772,7 +772,7 @@ sub commit {
        waitpid($pid,0);
        die "Error running git-commit-tree: $?\n" if $?;

- system("git-update-ref $remote/$branch $cid") == 0
+ system('git-update-ref', "$remote/$branch", $cid) == 0

                or die "Cannot write branch $branch for update: $!\n";

        if ($tag) {

--
1.5.5.1.178.gc1eb9.dirty