diff options
| author | jvoisin | 2019-02-09 15:23:16 +0100 |
|---|---|---|
| committer | jvoisin | 2019-02-09 15:23:16 +0100 |
| commit | 6e63e03b86916c697e411b9f382f98a4834779ff (patch) | |
| tree | 891ad0c04df90af2a435068a5b9018e8b3ccefb1 | |
| parent | a71488d4592cef29d6db0981cd0721250eebaff4 (diff) | |
Streamline a bit the previous commit
| -rw-r--r-- | libmat2/subprocess.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libmat2/subprocess.py b/libmat2/subprocess.py index e9c66d9..cf24176 100644 --- a/libmat2/subprocess.py +++ b/libmat2/subprocess.py | |||
| @@ -32,22 +32,26 @@ def _get_bwrap_path() -> str: | |||
| 32 | def _get_bwrap_args(tempdir: str, | 32 | def _get_bwrap_args(tempdir: str, |
| 33 | input_filename: str, | 33 | input_filename: str, |
| 34 | output_filename: Optional[str] = None) -> List[str]: | 34 | output_filename: Optional[str] = None) -> List[str]: |
| 35 | ro_bind_args = [] | ||
| 35 | cwd = os.getcwd() | 36 | cwd = os.getcwd() |
| 36 | 37 | ||
| 37 | # XXX: use --ro-bind-try once all supported platforms | 38 | # XXX: use --ro-bind-try once all supported platforms |
| 38 | # have a bubblewrap recent enough to support it. | 39 | # have a bubblewrap recent enough to support it. |
| 39 | ro_bind_dirs = ['/usr', '/lib', '/lib64', '/bin', '/sbin', cwd] | 40 | ro_bind_dirs = ['/usr', '/lib', '/lib64', '/bin', '/sbin', cwd] |
| 40 | ro_bind_args = [] | ||
| 41 | for bind_dir in ro_bind_dirs: | 41 | for bind_dir in ro_bind_dirs: |
| 42 | if os.path.isdir(bind_dir): # pragma: no cover | 42 | if os.path.isdir(bind_dir): # pragma: no cover |
| 43 | ro_bind_args.extend(['--ro-bind', bind_dir, bind_dir]) | 43 | ro_bind_args.extend(['--ro-bind', bind_dir, bind_dir]) |
| 44 | 44 | ||
| 45 | ro_bind_files = ['/etc/ld.so.cache'] | ||
| 46 | for bind_file in ro_bind_files: | ||
| 47 | if os.path.isfile(bind_file): # pragma: no cover | ||
| 48 | ro_bind_args.extend(['--ro-bind', bind_file, bind_file]) | ||
| 49 | |||
| 45 | args = ro_bind_args + \ | 50 | args = ro_bind_args + \ |
| 46 | ['--dev', '/dev', | 51 | ['--dev', '/dev', |
| 47 | '--chdir', cwd, | 52 | '--chdir', cwd, |
| 48 | '--unshare-all', | 53 | '--unshare-all', |
| 49 | '--new-session', | 54 | '--new-session', |
| 50 | '--ro-bind', '/etc/ld.so.cache', '/etc/ld.so.cache', | ||
| 51 | # XXX: enable --die-with-parent once all supported platforms have | 55 | # XXX: enable --die-with-parent once all supported platforms have |
| 52 | # a bubblewrap recent enough to support it. | 56 | # a bubblewrap recent enough to support it. |
| 53 | # '--die-with-parent', | 57 | # '--die-with-parent', |
