about summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
authorTimo Kaufmann <timokau@zoho.com>2019-01-18 23:02:03 +0100
committerGitHub <noreply@github.com>2019-01-18 23:02:03 +0100
commitd34f44db4508cdcce96382cb80bd11fbe9c7d614 (patch)
tree8f8892c5c79d97bca6f5b53fe35d9cf151d68dd0 /pkgs/applications/science
parenta26117593dfa034ea444ba9ac7ce38bb1ace4b97 (diff)
downloadnixlib-d34f44db4508cdcce96382cb80bd11fbe9c7d614.tar
nixlib-d34f44db4508cdcce96382cb80bd11fbe9c7d614.tar.gz
nixlib-d34f44db4508cdcce96382cb80bd11fbe9c7d614.tar.bz2
nixlib-d34f44db4508cdcce96382cb80bd11fbe9c7d614.tar.lz
nixlib-d34f44db4508cdcce96382cb80bd11fbe9c7d614.tar.xz
nixlib-d34f44db4508cdcce96382cb80bd11fbe9c7d614.tar.zst
nixlib-d34f44db4508cdcce96382cb80bd11fbe9c7d614.zip
sage: fix transient ecl error (#54285)
Sometimes the doctests fail because ecl races to create a directory.
This should fix that by making sure each process has its own directory.
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/math/sage/patches/fix-ecl-race.patch19
-rw-r--r--pkgs/applications/science/math/sage/sage-src.nix3
2 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/applications/science/math/sage/patches/fix-ecl-race.patch b/pkgs/applications/science/math/sage/patches/fix-ecl-race.patch
new file mode 100644
index 000000000000..6056416c3a28
--- /dev/null
+++ b/pkgs/applications/science/math/sage/patches/fix-ecl-race.patch
@@ -0,0 +1,19 @@
+diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py
+index 02e18e67e7..2ebf6eb35f 100644
+--- a/src/sage/doctest/forker.py
++++ b/src/sage/doctest/forker.py
+@@ -1075,6 +1075,14 @@ class SageDocTestRunner(doctest.DocTestRunner, object):
+             sage: set(ex2.predecessors) == set([ex0,ex1])
+             True
+         """
++
++        # Fix ECL dir race conditions by using a separate dir for each process
++        # (https://trac.sagemath.org/ticket/26968)
++        os.environ['MAXIMA_USERDIR'] = "{}/sage-maxima-{}".format(
++            tempfile.gettempdir(),
++            os.getpid()
++        )
++
+         if isinstance(globs, RecordingDict):
+             globs.start()
+         example.sequence_number = len(self.history)
diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix
index c4760764a437..5bdd53b37e4f 100644
--- a/pkgs/applications/science/math/sage/sage-src.nix
+++ b/pkgs/applications/science/math/sage/sage-src.nix
@@ -46,6 +46,9 @@ stdenv.mkDerivation rec {
     # tests) are also run. That is necessary to test dochtml individually. See
     # https://trac.sagemath.org/ticket/26110 for an upstream discussion.
     ./patches/Only-test-py2-py3-optional-tests-when-all-of-sage-is.patch
+
+    # Fixes a potential race condition which can lead to transient doctest failures.
+    ./patches/fix-ecl-race.patch
   ];
 
   # Patches needed because of package updates. We could just pin the versions of