
Index: ChangeLog from Akim Demaille <akim@epita.fr> prcs2svn failed on a file containing $$. * prcs2svn/prcs2svn.py (quote): Escape shell special chars. Use it when calling chmod. Index: prcs2svn/prcs2svn.py --- prcs2svn/prcs2svn.py (revision 100) +++ prcs2svn/prcs2svn.py (working copy) @@ -152,9 +152,10 @@ trace ("rm -rf " + dir) shutil.rmtree (dir, True) -## Add quote for filename, directory's name, ... -def quote(path): - return "\"" + path + "\"" +def quote (arg): + """Escape ARG to be suitable as literal for shell invocation + (e.g., via system calls).""" + return "\"" + re.sub (r'(["\\$`])', r'\\\1', arg) + "\"" ## (Un)escape special chars in sh. def string_unescape(s): @@ -538,7 +539,7 @@ xcopy(f, tmp) fd_tmp = open (os.path.join (tmp, os.path.basename (f)), "r") # FIXME: in python, we should have that. - xsystem("chmod +w " + f) + xsystem("chmod +w " + quote (f)) fd_f = open(f, "w+") for l in fd_tmp: l = self.change_keywords_line(f, l)