aboutsummaryrefslogtreecommitdiff
path: root/build2/scope.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-01-14 13:51:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-01-14 13:51:31 +0200
commit28fb279aba3af8bf1a57a9e36b2b183ef68c5454 (patch)
tree1f8701bbd996b347ecbc024865159c9df457fec2 /build2/scope.cxx
parent53e7e314e89f7e6262a8b169ce4c5aa872b8ceee (diff)
Diagnose target names with multiple trailing slashes as invalid
Diffstat (limited to 'build2/scope.cxx')
-rw-r--r--build2/scope.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/build2/scope.cxx b/build2/scope.cxx
index feac2fe..7ea4f42 100644
--- a/build2/scope.cxx
+++ b/build2/scope.cxx
@@ -667,7 +667,15 @@ namespace build2
fail (loc) << "invalid path '" << e.path << "'";
}
- v.erase (0, p + 1);
+ // This is probably too general of a place to ignore multiple trailing
+ // slashes and treat it as a directory (e.g., we don't want to
+ // encourage this sloppiness in buildfiles). We could, however, do it
+ // for certain contexts, such as buildspec. Maybe a lax flag?
+ //
+ if (++p == v.size ())
+ fail (loc) << "invalid name '" << v << "'";
+
+ v.erase (0, p);
}
// Extract the extension.