Re: [PATCH] Put quotes around branch names to prevent special characters from being interpreted by the shell.
- From
Jeff King <peff@peff.net>
- Date
- Jun 6, 2010, 21:55 UTC
- Message-ID
- <20100606215505.GB6993@coredump.intra.peff.net>
- In-Reply-To
- <1275666800-31852-1-git-send-email-bmeyer@rim.com>
On Fri, Jun 04, 2010 at 11:53:20AM -0400, Benjamin C Meyer wrote:
Show 5 quoted lines
> Perforce branch names with spaces (and other special characters) were
> causing issues.
> [...]
> - details = p4Cmd("branch -o %s" % info["branch"])
> + details = p4Cmd("branch -o \"%s\"" % info["branch"])Won't this still fail if your branch name contains quotation marks or backslashes? Does python have some equivalent to perl's quotemeta to just shell-escape the problematic characters (or even a way of just using a straight list in p4Cmd and avoiding the shell altogether)?
I know those characters may not be common, but if we are going to quote, perhaps we should make it foolproof.
-Peff