Srdjan Grubor added the comment:

Also, extract_member in tarfile.py is not thread-safe since the check for 
folder existence might occur during another thread's creation of that same dir 
causing the code to error out.

  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "./xdelta3-dir-patcher", line 499, in _apply_file_delta
    archive_object.expand(patch_file, staging_dir)
  File "./xdelta3-dir-patcher", line 284, in expand
    self.archive_object.extract(member, extraction_path)
  File "/usr/lib/python3.4/tarfile.py", line 2019, in extract
    set_attrs=set_attrs)
  File "/usr/lib/python3.4/tarfile.py", line 2080, in _extract_member
    os.makedirs(upperdirs)
  File "/usr/lib/python3.4/os.py", line 237, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: 
'/tmp/XDelta3DirPatcher_is0y4_5f/xdelta/updated folder'

Code causing problems:
2065     def _extract_member(self, tarinfo, targetpath, set_attrs=True):
...
2075         # Create all upper directories.
2076         upperdirs = os.path.dirname(targetpath)
2077         if upperdirs and not os.path.exists(upperdirs):
...
2080             os.makedirs(upperdirs)  # Fails since the dir might be already 
created between lines 2077 and 2080

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23649>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to