Skip to content

Commit

Permalink
Always extract packages to a temporary directory first
Browse files Browse the repository at this point in the history
This avoids a package being partially extracted if the conda
process is interrupted.
  • Loading branch information
gqmelo committed May 5, 2016
1 parent 4e3f231 commit d09d934
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion conda/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,9 +720,12 @@ def extract(dist):
pkgs_dir = dirname(fname)
with Locked(pkgs_dir):
path = fname[:-8]
temp_path = path + '.tmp'
rm_rf(path)
rm_rf(temp_path)
t = tarfile.open(fname)
t.extractall(path=path)
t.extractall(path=temp_path)
os.rename(temp_path, path)
t.close()
if sys.platform.startswith('linux') and os.getuid() == 0:
# When extracting as root, tarfile will by restore ownership
Expand Down

0 comments on commit d09d934

Please sign in to comment.