[ARVADOS] created: b495d8bd000cc60e2288b93a788aa71cce7f6dec

git at public.curoverse.com git at public.curoverse.com
Tue Feb 3 15:40:14 EST 2015


        at  b495d8bd000cc60e2288b93a788aa71cce7f6dec (commit)


commit b495d8bd000cc60e2288b93a788aa71cce7f6dec
Author: Brett Smith <brett at curoverse.com>
Date:   Tue Feb 3 15:40:10 2015 -0500

    5131: run-command consumes escape backslashes.
    
    run-command has long recognized backslashes to inhibit
    substitution, but it was leaving those backslashes in the string,
    which could lead to incorrect commands.  This commit makes sure
    they're removed after they're parsed.

diff --git a/crunch_scripts/crunchutil/subst.py b/crunch_scripts/crunchutil/subst.py
index 06ef6c1..fad9b06 100644
--- a/crunch_scripts/crunchutil/subst.py
+++ b/crunch_scripts/crunchutil/subst.py
@@ -1,7 +1,10 @@
-import os
 import glob
+import os
+import re
 import stat
 
+BACKSLASH_ESCAPE_RE = re.compile(r'\\(.)')
+
 class SubstitutionError(Exception):
     pass
 
@@ -73,7 +76,7 @@ def do_substitution(p, c, subs=default_subs):
     while True:
         m = search(c)
         if m is None:
-            return c
+            return BACKSLASH_ESCAPE_RE.sub(r'\1', c)
 
         v = do_substitution(p, c[m[0]+2 : m[1]])
         var = True

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list