Skip to content

Commit

Permalink
Prevent non-atomic writes to repodata JSON files
Browse files Browse the repository at this point in the history
Fixes: conda#3833
  • Loading branch information
sscherfke committed Dec 19, 2019
1 parent dc645d4 commit 94734d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Contributors:
* @AndrewAnnex
* @183amir
* @njzjz
* @sscherfke

Bug fixes:
----------

* Prevent non-atomic writes to repodata JSON files #3833


2019-10-14 3.18.10:
Expand Down Expand Up @@ -79,7 +85,7 @@ Enhancements:
-------------

* add --use-channeldata argument to conda render/build.
* Extract the part in the skeletons pypi responsible to get the package metadata to a free function.
* Extract the part in the skeletons pypi responsible to get the package metadata to a free function.
* Creat unittests for the get_package_metadata (skeletons/pypi.py) and for the new functions.

Bug fixes:
Expand Down
5 changes: 3 additions & 2 deletions conda_build/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from os.path import abspath, basename, getmtime, getsize, isdir, isfile, join, splitext, dirname
import subprocess
import sys
from tempfile import gettempdir
import time
from uuid import uuid4

Expand Down Expand Up @@ -419,7 +418,9 @@ def _filter_add_href(text, link, **kwargs):


def _maybe_write(path, content, write_newline_end=False, content_is_binary=False):
temp_path = join(gettempdir(), str(uuid4()))
# Create the temp file next "path" so that we can use an atomic move, see
# https://github.com/conda/conda-build/issues/3833
temp_path = '%s.%s' % (path, uuid4())

if not content_is_binary:
content = ensure_binary(content)
Expand Down

0 comments on commit 94734d3

Please sign in to comment.