On Sun, Jun 6, 2010 at 5:55 PM, Jeff King <peff@xxxxxxxx> wrote: > On Fri, Jun 04, 2010 at 11:53:20AM -0400, Benjamin C Meyer wrote: > >> 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 from commands import mkarg mkarg(arg) will enclose arg in single quotes if it contains none; else it will enclose arg in double quotes and backslash escape shell meta characters (any of \ $ " `). BTW, quotemeta is technically intended for use with regular expressions, isn't it? > (or even a way of just > using a straight list in p4Cmd and avoiding the shell altogether)? The subprocess module. > I know those characters may not be common, but if we are going to quote, > perhaps we should make it foolproof. +1. j. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html