python2: backport fix for pyc race condition#64067
Merged
FRidh merged 1 commit intoNixOS:stagingfrom Jul 3, 2019
Merged
Conversation
This is python bug https://bugs.python.org/issue13146. Fixed since python 3.4. It makes pyc creation atomic, preventing a race condition. The patch has been rebased on our deterministic build patch. It wasn't backported to python 2.7 because there was a complaint about changed semantics. Since files are now created in a temporary directory and then moved, symlinks will be overridden. See https://bugs.python.org/issue17222. That is an edge-case however. Ubuntu and debian have backported the fix in 2013 already, making it mainstream enough for us to adopt.
This was referenced Jul 12, 2019
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation for this change
This is python bug https://bugs.python.org/issue13146. Fixed since
python 3.4. It makes pyc creation atomic, preventing a race condition.
The patch has been rebased on our deterministic build patch.
It wasn't backported to python 2.7 because there was a complaint about
changed semantics. Since files are now created in a temporary directory
and then moved, symlinks will be overridden. See
https://bugs.python.org/issue17222.
That is an edge-case however. Ubuntu and debian have backported the fix
in 2013 already, making it mainstream enough for us to adopt.
CC @FRidh. I became aware of this bug while trying to build the py2 version of tensorflow from source with 12 build cores (#63616). I have also seen transient test failures for sage on hydra several times that may have been caused by this bug.
Things done
sandboxinnix.confon non-NixOS)nix-shell -p nix-review --run "nix-review wip"./result/bin/)nix path-info -Sbefore and after)