aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-12-19 13:01:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-12-19 13:01:13 +0200
commitf567b582ca26bd27869a451b8620411844a66479 (patch)
treecbe5086f6b1fab6fc7fde6a97d047db4591442fe
parent6ae9675fc04af104ef995f571d05300f18a9363d (diff)
Disable line continuation in buildspec, command line variable overrides
Line continuations would make directory paths on Windows unusable, for example: b C:\myproj\
-rw-r--r--libbuild2/context.cxx9
-rw-r--r--libbuild2/parser.cxx10
2 files changed, 11 insertions, 8 deletions
diff --git a/libbuild2/context.cxx b/libbuild2/context.cxx
index 08c4e7e..ccfa7f3 100644
--- a/libbuild2/context.cxx
+++ b/libbuild2/context.cxx
@@ -379,12 +379,13 @@ namespace build2
is.exceptions (istringstream::failbit | istringstream::badbit);
// Similar to buildspec we do "effective escaping" of the special
- // `'"\$(` characters, line continuations, plus `)` for symmetry
- // (basically what's escapable inside a double-quoted literal plus the
- // single quote).
+ // `'"\$(` 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).
//
path_name in ("<cmdline>");
- lexer l (is, in, 1 /* line */, "\'\"\\$()\n");
+ 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 4350c88..2c8c8a6 100644
--- a/libbuild2/parser.cxx
+++ b/libbuild2/parser.cxx
@@ -8163,12 +8163,14 @@ namespace build2
buildspec parser::
parse_buildspec (istream& is, const path_name& in)
{
- // We do "effective escaping" of the special `'"\$(` characters, line
- // continuations, plus `)` for symmetry (basically what's escapable inside
- // a double-quoted literal plus the single quote).
+ // 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).
//
path_ = &in;
- lexer l (is, *path_, 1 /* line */, "\'\"\\$()\n");
+ lexer l (is, *path_, 1 /* line */, "\'\"\\$()");
lexer_ = &l;
root_ = &ctx->global_scope.rw ();