diff options
author | William Deegan <bill@baddogconsulting.com> | 2016-02-29 03:41:36 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2016-02-29 03:41:36 (GMT) |
commit | ed53a2e548f6e5623bf6cb700994c5f17dceb7d0 (patch) | |
tree | aed0b82e14f74c58a4279baa9e251f881d09b55b | |
parent | b0f4c6bc7b32102a75e2d6c8ef880e6135cbfd53 (diff) | |
download | SCons-ed53a2e548f6e5623bf6cb700994c5f17dceb7d0.zip SCons-ed53a2e548f6e5623bf6cb700994c5f17dceb7d0.tar.gz SCons-ed53a2e548f6e5623bf6cb700994c5f17dceb7d0.tar.bz2 |
Fix for bug # 2225. This undoes the changes to posix special escape characters added in patch for bug 1689
-rw-r--r-- | src/engine/SCons/Platform/PlatformTests.py | 20 | ||||
-rw-r--r-- | src/engine/SCons/Platform/posix.py | 6 |
2 files changed, 23 insertions, 3 deletions
diff --git a/src/engine/SCons/Platform/PlatformTests.py b/src/engine/SCons/Platform/PlatformTests.py index 38ea55a..3432e94 100644 --- a/src/engine/SCons/Platform/PlatformTests.py +++ b/src/engine/SCons/Platform/PlatformTests.py @@ -187,11 +187,29 @@ class TempFileMungeTestCase(unittest.TestCase): assert cmd != defined_cmd, cmd assert cmd == getattr(target[0].attributes, 'tempfile_cmdlist', None) +class PlatformEscapeTestCase(unittest.TestCase): + def test_posix_escape(self): + """ Check that paths with parens are escaped properly + """ + import SCons.Platform.posix + + test_string = "/my (really) great code/main.cpp" + output = SCons.Platform.posix.escape(test_string) + + # We expect the escape function to wrap the string + # in quotes, but not escape any internal characters + # in the test_string. (Parens doesn't require shell + # escaping if their quoted) + assert output[1:-1] == test_string + + if __name__ == "__main__": suite = unittest.TestSuite() tclasses = [ PlatformTestCase, - TempFileMungeTestCase ] + TempFileMungeTestCase, + PlatformEscapeTestCase, + ] for tclass in tclasses: names = unittest.getTestCaseNames(tclass, 'test_') suite.addTests(list(map(tclass, names))) diff --git a/src/engine/SCons/Platform/posix.py b/src/engine/SCons/Platform/posix.py index 7e69a7c..190a2a6 100644 --- a/src/engine/SCons/Platform/posix.py +++ b/src/engine/SCons/Platform/posix.py @@ -48,16 +48,18 @@ exitvalmap = { } def escape(arg): - "escape shell special characters" + "escape shell special characters" slash = '\\' - special = '"$()' + special = '"$' arg = arg.replace(slash, slash+slash) for c in special: arg = arg.replace(c, slash+c) + # print "ESCAPE RESULT: %s"%arg return '"' + arg + '"' + def exec_subprocess(l, env): proc = subprocess.Popen(l, env = env, close_fds = True) return proc.wait() |