Prevent projects from grabbing other projects' options.

pull/2410/head
Jussi Pakkanen 7 years ago
parent 7d49d1d2d7
commit 1b442d11b4
  1. 3
      mesonbuild/interpreter.py
  2. 5
      test cases/failing/61 getoption prefix/meson.build
  3. 1
      test cases/failing/61 getoption prefix/subprojects/abc/meson.build
  4. 1
      test cases/failing/61 getoption prefix/subprojects/abc/meson_options.txt

@ -1700,6 +1700,9 @@ class Interpreter(InterpreterBase):
if len(args) != 1:
raise InterpreterException('Argument required for get_option.')
optname = args[0]
if ':' in optname:
raise InterpreterException('''Having a colon in option name is forbidden, projects are not allowed
to directly access options of other subprojects.''')
try:
return self.environment.get_coredata().base_options[optname].value
except KeyError:

@ -0,0 +1,5 @@
project('getopt prefix')
subproject('abc')
get_option('abc:foo')
Loading…
Cancel
Save