Chromium Code Reviews| Index: client/isolateserver.py |
| diff --git a/client/isolateserver.py b/client/isolateserver.py |
| index 22ab89cdefabf1af5b24024fa862765f16ef9d3d..0e1ad010d2513d33da550d19e50c0fd1fdf01d99 100755 |
| --- a/client/isolateserver.py |
| +++ b/client/isolateserver.py |
| @@ -18,6 +18,7 @@ import re |
| import signal |
| import stat |
| import sys |
| +import tarfile |
| import tempfile |
| import threading |
| import time |
| @@ -169,6 +170,11 @@ def fileobj_path(fileobj): |
| if not isinstance(name, unicode): |
| name = name.decode(sys.getfilesystemencoding()) |
| + # fs.exists requires an absolute path, otherwise it will fail with an |
| + # assertion error. |
| + if not os.path.isabs(name): |
| + return |
| + |
| if fs.exists(name): |
| return name |
| @@ -2107,6 +2113,20 @@ def fetch_isolated(isolated_hash, storage, cache, outdir, use_symlinks): |
| srcfileobj, fullpath, file_mode, |
| use_symlink=use_symlinks) |
| + elif filetype == 'tar': |
| + basedir = os.path.dirname(fullpath) |
| + extractor = tarfile.TarFile(fileobj=srcfileobj) |
|
M-A Ruel
2016/11/08 14:33:44
with tarfile.TarFile(fileobj=srcfileobj) as t:
f
mithro
2016/11/09 00:19:35
Done.
|
| + for ti in extractor: |
| + if not ti.isfile(): |
| + logging.warning( |
| + "Nonfile (%s) object %s skipped", ti.type, ti.name) |
| + continue |
| + ifd = extractor.extractfile(ti) |
| + fp = os.path.normpath(os.path.join(basedir, ti.name)) |
|
M-A Ruel
2016/11/08 14:33:44
if not fp.startswith(basedir):
logging.error('ta
mithro
2016/11/09 00:19:35
Done.
|
| + file_path.ensure_tree(os.path.dirname(fp)) |
| + putfile(ifd, fp, 0700, ti.size) |
| + extractor.close() |
| + |
| elif filetype == 'ar': |
| basedir = os.path.dirname(fullpath) |
| extractor = arfile.ArFileReader(srcfileobj, fullparse=False) |