From d26513dfc591b2e72f073b72a27c5316090956ec Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Wed, 14 Feb 2018 00:31:41 +0200 Subject: [PATCH] Permit path separators in subdir names but with a warning. Closes #2794. --- mesonbuild/interpreter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 38aca7537096..c1bdb090fb47 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1735,8 +1735,12 @@ def func_subproject(self, nodes, args, kwargs): return self.do_subproject(dirname, kwargs) def do_subproject(self, dirname, kwargs): - if '/' in dirname or '\\' in dirname: - raise InterpreterException('Subproject name must not contain a path separator.') + if '..' in dirname: + raise InterpreterException('Subproject name must not contain a ".." path segment.') + if os.path.isabs(dirname): + raise InterpreterException('Subproject name must not be an absolute path.') + if '\\' in dirname or '/' in dirname: + mlog.warning('Subproject name has a path separator. This may cause unexpected behaviour.') if dirname in self.subproject_stack: fullstack = self.subproject_stack + [dirname] incpath = ' => '.join(fullstack)