{"thread":{"id":"13315","subject":"cvsimport and branches with \"(\" in the name","startedAt":"2008-04-29T07:22:02Z","lastAt":"2008-04-30T03:31:46Z","messageCount":4,"participants":["Nigel Magnay","Jeff King","Morten Welinder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"75508","messageId":"320075ff0804290022r56c9f4efx74a13d3502be212@mail.gmail.com","threadId":"13315","inReplyTo":null,"subject":"cvsimport and branches with \"(\" in the name","fromName":"Nigel Magnay","fromEmail":"nigel.magnay@gmail.com","sentAt":"2008-04-29T07:22:02Z","receivedAt":"2008-04-29T07:22:02Z","isPatch":false,"sender":{"key":"nigel.magnay@gmail.com","avatar":"https://gravatar.com/avatar/d85cf38287bef3a8e4fa02358d2756d7589f8676c5eeb881ce2f6d731e4526c3?d=mp&s=160"},"body":"git 1.5.4.4 on ubuntu, I cvsimport a repository that has an oddly\nnamed branch - I get\n\nsh: Syntax error: \"(\" unexpected\nCannot write branch ChapelHill_3_0(iteration2)_esap_demo for update:\nBad file descriptor\n\nthough the end of my -v log shows\n\nTree ID 46f13621661205b02a80d7d431a2c59be500ae45\nParent ID d635ccf06e1cac3afacc4fba6e70bba7f771ead2\nCommitted patch 1956 (ChapelHill_3_0(iteration2)_esap_demo +0000\n2006-12-04 10:28:31)\nCommit ID 76c991af0c690d9ae5471c0b661dfba3b3df18c6\n\nand refs/heads has a correctly named file\n\nMy guess is something in the guts isn't liking the ( character, when\ncommitting the next patch.\n\nAny ideas on how to diagnose / fix it further ?\n"},{"id":"75536","messageId":"20080429155238.GA18494@sigill.intra.peff.net","threadId":"13315","inReplyTo":"320075ff0804290022r56c9f4efx74a13d3502be212@mail.gmail.com","subject":"Re: cvsimport and branches with \"(\" in the name","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-04-29T15:52:38Z","receivedAt":"2008-04-29T15:52:38Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Apr 29, 2008 at 08:22:02AM +0100, Nigel Magnay wrote:\n\n> git 1.5.4.4 on ubuntu, I cvsimport a repository that has an oddly\n> named branch - I get\n> \n> sh: Syntax error: \"(\" unexpected\n> Cannot write branch ChapelHill_3_0(iteration2)_esap_demo for update:\n> Bad file descriptor\n\nLooks like cvsimport is handing something as an argument to a git\ncommand, but we accidentally involve the shell. Maybe here:\n\ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nindex 95c5eec..bdac5d5 100755\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -772,7 +772,7 @@ sub commit {\n \twaitpid($pid,0);\n \tdie \"Error running git-commit-tree: $?\\n\" if $?;\n \n-\tsystem(\"git-update-ref $remote/$branch $cid\") == 0\n+\tsystem('git-update-ref', \"$remote/$branch\", $cid) == 0\n \t\tor die \"Cannot write branch $branch for update: $!\\n\";\n \n \tif ($tag) {\n\nDoes that fix it?\n\n> Any ideas on how to diagnose / fix it further ?\n\nIf that doesn't work, you might try running with GIT_TRACE=1, and then\nyou can see which commands are being run when the error occurs.\n\n-Peff\n"},{"id":"75618","messageId":"118833cc0804291745m2da2a3bdl21a9440e961afb6@mail.gmail.com","threadId":"13315","inReplyTo":"20080429155238.GA18494@sigill.intra.peff.net","subject":"Re: cvsimport and branches with \"(\" in the name","fromName":"Morten Welinder","fromEmail":"mwelinder@gmail.com","sentAt":"2008-04-30T00:45:42Z","receivedAt":"2008-04-30T00:45:42Z","isPatch":false,"sender":{"key":"mwelinder@gmail.com","avatar":null},"body":">  -       system(\"git-update-ref $remote/$branch $cid\") == 0\n>  +       system('git-update-ref', \"$remote/$branch\", $cid) == 0\n\nI hope there are no further such system calls left.  This could run arbitrary\ncommands if one was tricked into importing an evil repository.\n\nMorten\n"},{"id":"75626","messageId":"20080430033146.GA28373@sigill.intra.peff.net","threadId":"13315","inReplyTo":"118833cc0804291745m2da2a3bdl21a9440e961afb6@mail.gmail.com","subject":"Re: cvsimport and branches with \"(\" in the name","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-04-30T03:31:46Z","receivedAt":"2008-04-30T03:31:46Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Apr 29, 2008 at 08:45:42PM -0400, Morten Welinder wrote:\n\n> >  -       system(\"git-update-ref $remote/$branch $cid\") == 0\n> >  +       system('git-update-ref', \"$remote/$branch\", $cid) == 0\n> \n> I hope there are no further such system calls left.  This could run arbitrary\n> commands if one was tricked into importing an evil repository.\n\nYes, even if that doesn't fix his problem, it should still be changed. I\nhave confirmed that it's the only such one in git-cvsimport.\n\n-Peff\n"}]}