From 409bfb37ebca7e6762dec50ecb5ab61637fc32ba Mon Sep 17 00:00:00 2001 From: stevenknight Date: Sat, 5 Nov 2005 23:14:01 +0000 Subject: [PATCH] Fix a bug in command-line escaping. (Jan Nieuwenhuizen) git-svn-id: http://scons.tigris.org/svn/scons/trunk@1378 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 11 +++++++++++ src/engine/SCons/Subst.py | 16 +++++++++++++--- src/engine/SCons/SubstTests.py | 19 +++++++++++++++++-- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 38a04767..f65e0618 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -449,6 +449,10 @@ RELEASE 0.97 - XXX value directory; avoiding slowing substitution logic when there's no '$' in the string. + From Jan Nieuwenhuizen: + + - Fix a problem with interpreting quoted argument lists on command lines. + From Greg Noel: - Add construction variables to support frameworks on Mac OS X: @@ -706,6 +710,13 @@ RELEASE 0.97 - XXX - Update EnsureSConsVersion() to support revision numbers. + From Dobes Vandermeer: + + - Add support for SCC and other settings in Microsoft Visual + Studio project and solution files: $MSVS_PROJECT_BASE_PATH, + $MSVS_PROJECT_GUID, $MSVS_SCC_AUX_PATH, $MSVS_SCC_LOCAL_PATH, + $MSVS_SCC_PROJECT_NAME, $MSVS_SCC_PROVIDER, + From Greg Ward: - Fix a misplaced line in the man page. diff --git a/src/engine/SCons/Subst.py b/src/engine/SCons/Subst.py index 47674039..56522a13 100644 --- a/src/engine/SCons/Subst.py +++ b/src/engine/SCons/Subst.py @@ -708,11 +708,21 @@ def scons_subst_list(strSubst, env, mode=SUBST_RAW, target=None, source=None, gv self.add_new_word(x) else: y = current_word + x - literal1 = self.literal(self[-1][-1]) - literal2 = self.literal(x) + + # We used to treat a word appended to a literal + # as a literal itself, but this caused problems + # with interpreting quotes around space-separated + # targets on command lines. Removing this makes + # none of the "substantive" end-to-end tests fail, + # so we'll take this out but leave it commented + # for now in case there's a problem not covered + # by the test cases and we need to resurrect this. + #literal1 = self.literal(self[-1][-1]) + #literal2 = self.literal(x) y = self.conv(y) if is_String(y): - y = CmdStringHolder(y, literal1 or literal2) + #y = CmdStringHolder(y, literal1 or literal2) + y = CmdStringHolder(y, None) self[-1][-1] = y def add_new_word(self, x): diff --git a/src/engine/SCons/SubstTests.py b/src/engine/SCons/SubstTests.py index 64a2fe5a..8a56f674 100644 --- a/src/engine/SCons/SubstTests.py +++ b/src/engine/SCons/SubstTests.py @@ -818,11 +818,26 @@ class SubstTestCase(unittest.TestCase): c = cmd_list[0][3].escape(escape_func) assert c == 'xyz', c + # We used to treat literals smooshed together like the whole + # thing was literal and escape it as a unit. The commented-out + # asserts below are in case we ever have to find a way to + # resurrect that functionality in some way. cmd_list = scons_subst_list("abc${LITERALS}xyz", env, gvars=gvars) c = cmd_list[0][0].escape(escape_func) - assert c == '**abcfoo\nwith\nnewlines**', c + #assert c == '**abcfoo\nwith\nnewlines**', c + assert c == 'abcfoo\nwith\nnewlines', c c = cmd_list[0][1].escape(escape_func) - assert c == '**bar\nwith\nnewlinesxyz**', c + #assert c == '**bar\nwith\nnewlinesxyz**', c + assert c == 'bar\nwith\nnewlinesxyz', c + + cmd_list = scons_subst_list('echo "target: $TARGET"', env, + target=_t, gvars=gvars) + c = cmd_list[0][0].escape(escape_func) + assert c == 'echo', c + c = cmd_list[0][1].escape(escape_func) + assert c == '"target:', c + c = cmd_list[0][2].escape(escape_func) + assert c == 't"', c # Tests of the various SUBST_* modes of substitution. subst_list_cases = [ -- 2.26.2