Handle .. within paths in gccdeps

The current code handles .. at the beginning of a path, but not within the path
This commit is contained in:
Matt Fischer 2015-07-27 11:38:03 -05:00
parent e10398fcd3
commit 2424393afd
1 changed files with 10 additions and 4 deletions

View File

@ -126,11 +126,17 @@ def post_run(self):
node = path_to_node(bld.root, x, cached_nodes)
else:
path = bld.bldnode
# when calling find_resource, make sure the path does not begin by '..'
# when calling find_resource, make sure the path does not contain '..'
x = [k for k in Utils.split_path(x) if k and k != '.']
while lst and x[0] == '..':
x = x[1:]
path = path.parent
while '..' in x:
idx = x.index('..')
if idx == 0:
x = x[1:]
path = path.parent
else:
del x[idx]
del x[idx-1]
node = path_to_node(path, x, cached_nodes)
if not node: