From 227ef6a5e1fb046f9fbbf6f1c325b088df405df5 Mon Sep 17 00:00:00 2001 From: Mauricio Collares Date: Sat, 1 Aug 2026 14:56:52 -0300 Subject: [PATCH] sage: work around gap/flint intermittent failures --- .../sa/sage/patches/faster-flint.patch | 22 +++++++++++++++++++ pkgs/by-name/sa/sage/sage-src.nix | 13 +++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 pkgs/by-name/sa/sage/patches/faster-flint.patch diff --git a/pkgs/by-name/sa/sage/patches/faster-flint.patch b/pkgs/by-name/sa/sage/patches/faster-flint.patch new file mode 100644 index 000000000000..dc47bd509e83 --- /dev/null +++ b/pkgs/by-name/sa/sage/patches/faster-flint.patch @@ -0,0 +1,22 @@ +diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx +index 191667c0d8d..8dff6c52aa0 100644 +--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx ++++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx +@@ -4659,7 +4659,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): + Ensure interrupt does not make the internal state inconsistent:: + + sage: R. = QQ[] +- sage: n = 11 # chosen so that the computation takes > 1 second but not excessively long. ++ sage: n = 12 # chosen so that the computation takes > 1 second but not excessively long. + ....: # when Singular improves the algorithm or hardware gets faster, increase n. + sage: alarm(0.5); h = (x^2^n-y^2^n).factor() + Traceback (most recent call last): +@@ -4671,7 +4671,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): + AlarmInterrupt + sage: h = (x^2^n-y^2^n).factor() + sage: h +- (x - y) * (x + y) * (x^2 + y^2) * (x^4 + y^4) * (x^8 + y^8) * (x^16 + y^16) * (x^32 + y^32) * (x^64 + y^64) * (x^128 + y^128) * (x^256 + y^256) * (x^512 + y^512) * (x^1024 + y^1024) ++ (x - y) * (x + y) * (x^2 + y^2) * (x^4 + y^4) * (x^8 + y^8) * (x^16 + y^16) * (x^32 + y^32) * (x^64 + y^64) * (x^128 + y^128) * (x^256 + y^256) * (x^512 + y^512) * (x^1024 + y^1024) * (x^2048 + y^2048) + """ + cdef ring *_ring = self._parent_ring + cdef intvec *iv diff --git a/pkgs/by-name/sa/sage/sage-src.nix b/pkgs/by-name/sa/sage/sage-src.nix index 64af4c74ec5b..f976e9e4c3c8 100644 --- a/pkgs/by-name/sa/sage/sage-src.nix +++ b/pkgs/by-name/sa/sage/sage-src.nix @@ -53,8 +53,7 @@ stdenv.mkDerivation rec { # "undefined symbol: cblas_ctrmv" errors. ./patches/revert-blas-mesonification.patch - # Darwin linkers fail unless some NTL-backed Cython C++ extensions link - # NTL directly instead of relying on transitive linkage. + # https://github.com/sagemath/sage/pull/42587 ./patches/link-ntl-directly-for-ntl-cython-extensions.patch # https://github.com/sagemath/sage/pull/41637 causes problems when @@ -85,6 +84,16 @@ stdenv.mkDerivation rec { # https://github.com/sagemath/sage/issues/42473 ./patches/lower-sleep2-test-threshold.patch + # https://github.com/sagemath/sage/pull/42611 + ./patches/faster-flint.patch + + # https://github.com/sagemath/sage/pull/41954, landed in 10.10.beta0 + (fetchpatch2 { + name = "gap-element-stability.patch"; + url = "https://github.com/sagemath/sage/commit/11da83dd3666c2509288a828c54eb0273ee0cf50.patch?full_index=1"; + hash = "sha256-CjZyeUJVIevDaStLs+9BMT9JlISEdRw3TyTIso/BXi0="; + }) + # https://github.com/sagemath/sage/pull/42009, landed in 10.10.beta0 (fetchpatch2 { name = "gap-root-paths.patch";