aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-02-01 14:07:01 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-01 14:07:01 +0200
commit280f4a5bf787587227ca193cd59c6bd74091db70 (patch)
tree70f20e3c11eb6a4b3cf650c84b45045a94d237b2
parent7b8055286bec7ee17575c572fe954c88b103419a (diff)
Diagnose out_base inside src_base
-rw-r--r--build2/b.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/build2/b.cxx b/build2/b.cxx
index 1106031..b827470 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -726,6 +726,14 @@ main (int argc, char* argv[])
//
src_base.normalize (true);
+ // Make sure out_base is not a subdirectory of src_base. Who would
+ // want to do that, you may ask. Well, you would be surprised...
+ //
+ if (out_base != src_base && out_base.sub (src_base))
+ fail << "out_base directory is inside src_base" <<
+ info << "src_base: " << src_base <<
+ info << "out_base: " << out_base;
+
// If the src_base was explicitly specified, search for src_root.
//
src_root = find_src_root (src_base);