aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-12-19 14:20:21 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-12-19 14:20:21 +0200
commit1457cdf3d7615f42d33246fb456bcb4332b35e6a (patch)
tree295fe0f0e88369c69d776b0c876199bcd0ee0367 /libbuild2
parentf567b582ca26bd27869a451b8620411844a66479 (diff)
Disable `)` escaping in buildspec, command line variable overrides
Similar to line continuations, that would make directory paths on Windows unusable, for example: b info(C:\myproj\) Note that while this is less of a problem in command line variable overrides, we disable it there for consistency.
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/context.cxx10
-rw-r--r--libbuild2/parser.cxx11
2 files changed, 10 insertions, 11 deletions
diff --git a/libbuild2/context.cxx b/libbuild2/context.cxx
index ccfa7f3..eabd279 100644
--- a/libbuild2/context.cxx
+++ b/libbuild2/context.cxx
@@ -379,13 +379,13 @@ namespace build2
is.exceptions (istringstream::failbit | istringstream::badbit);
// Similar to buildspec we do "effective escaping" of the special
- // `'"\$(` characters plus `)` for symmetry (basically what's escapable
- // inside a double-quoted literal plus the single quote; note, however,
- // that we exclude line continuations since they would make directory
- // paths on Windows unusable).
+ // `'"\$(` characters (basically what's escapable inside a double-quoted
+ // literal plus the single quote; note, however, that we exclude line
+ // continuations and `)` since they would make directory paths on
+ // Windows unusable).
//
path_name in ("<cmdline>");
- lexer l (is, in, 1 /* line */, "\'\"\\$()");
+ lexer l (is, in, 1 /* line */, "\'\"\\$(");
// At the buildfile level the scope-specific variable should be
// separated from the directory with a whitespace, for example:
diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx
index 2c8c8a6..0d51b49 100644
--- a/libbuild2/parser.cxx
+++ b/libbuild2/parser.cxx
@@ -8163,14 +8163,13 @@ namespace build2
buildspec parser::
parse_buildspec (istream& is, const path_name& in)
{
- // We do "effective escaping" of the special `'"\$(` characters plus `)`
- // for symmetry (basically what's escapable inside a double-quoted literal
- // plus the single quote; note, however, that we exclude line
- // continuations since they would make directory paths on Windows
- // unusable).
+ // We do "effective escaping" of the special `'"\$(` characters (basically
+ // what's escapable inside a double-quoted literal plus the single quote;
+ // note, however, that we exclude line continuations and `)` since they
+ // would make directory paths on Windows unusable).
//
path_ = &in;
- lexer l (is, *path_, 1 /* line */, "\'\"\\$()");
+ lexer l (is, *path_, 1 /* line */, "\'\"\\$(");
lexer_ = &l;
root_ = &ctx->global_scope.rw ();