runroot: Avoid squashing path components with os.path.join

Although this is often a surprising behaviour, the Python documentation
is quite clear on this:

    If a component is an absolute path, all previous components are
    thrown away and joining continues from the absolute path component.

    https://docs.python.org/2/library/os.path.html#os.path.join

That means we need to ensure that we don't end up in this case.
This commit is contained in:
Mathieu Bridon 2015-07-10 18:18:02 +02:00 committed by Dennis Gilmore
parent f426fdb05d
commit 8097ffce7b

View file

@ -51,6 +51,7 @@ class RunRootTask(tasks.BaseTaskHandler):
else:
options.append(o)
rel_path = path[len(mount_data['mountpoint']):]
rel_path = rel_path[1:] if rel_path.startswith('/') else rel_path
res = (os.path.join(mount_data['path'], rel_path), path, mount_data['fstype'], ','.join(options))
return res