Prohibit absolute paths in subdir().

pull/1382/merge
Jussi Pakkanen 8 years ago
parent 28353e10e1
commit 5ee92d5bb0
  1. 2
      mesonbuild/interpreter.py
  2. 2
      test cases/failing/42 abs subdir/bob/meson.build
  3. 6
      test cases/failing/42 abs subdir/meson.build

@ -2132,6 +2132,8 @@ requirements use the version keyword argument instead.''')
raise InvalidArguments('Must not go into subprojects dir with subdir(), use subproject() instead.') raise InvalidArguments('Must not go into subprojects dir with subdir(), use subproject() instead.')
prev_subdir = self.subdir prev_subdir = self.subdir
subdir = os.path.join(prev_subdir, args[0]) subdir = os.path.join(prev_subdir, args[0])
if os.path.isabs(subdir):
raise InvalidArguments('Subdir argument must be a relative path.')
if subdir in self.visited_subdirs: if subdir in self.visited_subdirs:
raise InvalidArguments('Tried to enter directory "%s", which has already been visited.' raise InvalidArguments('Tried to enter directory "%s", which has already been visited.'
% subdir) % subdir)

@ -0,0 +1,2 @@
# This file is never reached.
x = 3

@ -0,0 +1,6 @@
project('abs subdir', 'c')
# For some reason people insist on doing this, probably
# because Make has taught them to never rely on anything.
subdir(join_paths(meson.source_root(), 'bob'))
Loading…
Cancel
Save