aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreter.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-02-12 22:55:46 -0500
committerEli Schwartz <eschwartz@archlinux.org>2022-02-12 23:13:26 -0500
commitf08aabfb77753dd7b97d3e90c0d764f3f6332dfb (patch)
tree1e60675a7456dd27f7a7c9478dc2a8e2f46f361e /mesonbuild/interpreter/interpreter.py
parentb1e6cc5553f340e4e4c76f4dd355444d13d6a614 (diff)
downloadmeson-f08aabfb77753dd7b97d3e90c0d764f3f6332dfb.zip
meson-f08aabfb77753dd7b97d3e90c0d764f3f6332dfb.tar.gz
meson-f08aabfb77753dd7b97d3e90c0d764f3f6332dfb.tar.bz2
validate the literal directory "subprojects" when checking sandbox violations
We do not want anyone touching this entire directory tree, but due to the way it was implemented, we only checked if its direct parent was a subproject violation. This generally worked, unless people tried to add `subprojects/` as an include directory. Patch this hole. It now provides the same warning any sandbox violation does (but is not currently an error, just a "will become an error in the future").
Diffstat (limited to 'mesonbuild/interpreter/interpreter.py')
-rw-r--r--mesonbuild/interpreter/interpreter.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index d803fdb..12abdf0 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -2681,11 +2681,12 @@ Try setting b_lundef to false instead.'''.format(self.coredata.options[OptionKey
# /opt/vendorsdk/src/file_with_license_restrictions.c
return
project_root = Path(srcdir, self.root_subdir)
+ subproject_dir = project_root / self.subproject_dir
if norm == project_root:
return
if project_root not in norm.parents:
raise InterpreterException(f'Sandbox violation: Tried to grab {inputtype} {norm.name} outside current (sub)project.')
- if project_root / self.subproject_dir in norm.parents:
+ if subproject_dir == norm or subproject_dir in norm.parents:
raise InterpreterException(f'Sandbox violation: Tried to grab {inputtype} {norm.name} from a nested subproject.')
@T.overload