Target file name must not contain a path separator as that breaks things.

pull/1868/head
Jussi Pakkanen 8 years ago
parent 8d2fbf8084
commit 7882549f86
  1. 2
      mesonbuild/build.py
  2. 9
      mesonbuild/interpreter.py
  3. 12
      test cases/failing/53 slashname/meson.build
  4. 2
      test cases/failing/53 slashname/sub/meson.build
  5. 6
      test cases/failing/53 slashname/sub/prog.c

@ -270,6 +270,8 @@ class EnvironmentVariables:
class Target:
def __init__(self, name, subdir, build_by_default):
if '/' in name or '\\' in name:
raise InvalidArguments('Target name must not contain a path separator.')
self.name = name
self.subdir = subdir
self.build_by_default = build_by_default

@ -2593,7 +2593,14 @@ different subdirectory.
else:
mlog.debug('Unknown target type:', str(targetholder))
raise RuntimeError('Unreachable code')
target = targetclass(name, self.subdir, self.subproject, is_cross, sources, objs, self.environment, kwargs)
# Fix failing test 53 when removing this.
if '/' in name or '\\' in name:
mlog.warning('Target name must not contain a path separator. This will become a hard error in a future release.')
subpart, name = os.path.split(name)
subdir = os.path.join(self.subdir, subpart)
else:
subdir = self.subdir
target = targetclass(name, subdir, self.subproject, is_cross, sources, objs, self.environment, kwargs)
if is_cross:
self.add_cross_stdlib_info(target)
l = targetholder(target, self)

@ -0,0 +1,12 @@
project('slashname', 'c')
# Traverse this subdir so the corresponding dir
# is created inside the build dir.
subdir('sub')
# Try to create an executable that would go in the "sub" dir
# inside the build dir. This is prohibited.
executable('sub/prog', pf)
error('Re-enable me once slash in name is finally prohibited.')

@ -0,0 +1,6 @@
#include<stdio.h>
int main(int argc, char **argv) {
printf("I should not be run ever.\n");
return 1;
}
Loading…
Cancel
Save