This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sgnn7
Recipients sgnn7
Date 2015-03-12.16:45:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1426178757.91.0.366059379903.issue23649@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2015-03-12 16:45:57sgnn7setrecipients: + sgnn7
2015-03-12 16:45:57sgnn7setmessageid: <1426178757.91.0.366059379903.issue23649@psf.upfronthosting.co.za>
2015-03-12 16:45:57sgnn7linkissue23649 messages
2015-03-12 16:45:57sgnn7create