mirror of
https://github.com/ansible/awx.git
synced 2026-03-03 09:48:51 -03:30
Perform realpath() on paths passed to bubblewrap to avoid errors with symlinks
bubblewrap is creating a mount tree from a namespace outside the one it's creating. Absolute symlinks will not resolve properly, causing errors. Filed @ https://github.com/projectatomic/bubblewrap/issues/195, but this should work around it without side effects.
This commit is contained in:
@@ -702,6 +702,7 @@ def wrap_args_with_proot(args, cwd, **kwargs):
|
|||||||
for path in sorted(set(hide_paths)):
|
for path in sorted(set(hide_paths)):
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
continue
|
continue
|
||||||
|
path = os.path.realpath(path)
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
new_path = tempfile.mkdtemp(dir=kwargs['proot_temp_dir'])
|
new_path = tempfile.mkdtemp(dir=kwargs['proot_temp_dir'])
|
||||||
os.chmod(new_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
|
os.chmod(new_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
|
||||||
@@ -722,6 +723,7 @@ def wrap_args_with_proot(args, cwd, **kwargs):
|
|||||||
for path in sorted(set(show_paths)):
|
for path in sorted(set(show_paths)):
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
continue
|
continue
|
||||||
|
path = os.path.realpath(path)
|
||||||
new_args.extend(['--bind', '%s' % (path,), '%s' % (path,)])
|
new_args.extend(['--bind', '%s' % (path,), '%s' % (path,)])
|
||||||
new_args.extend(['--chdir', cwd])
|
new_args.extend(['--chdir', cwd])
|
||||||
new_args.extend(args)
|
new_args.extend(args)
|
||||||
|
|||||||
Reference in New Issue
Block a user