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 d262d43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,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
4 changes: 4 additions & 0 deletions news/index-atomic-write.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Bug fixes:
----------

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

0 comments on commit d262d43

Please sign in to comment.