diff --git a/srcpkgs/sagemath/patches/40594-Fix_segfault_in_libgap.patch b/srcpkgs/sagemath/patches/40594-Fix_segfault_in_libgap.patch new file mode 100644 index 00000000000..b26ac2f691c --- /dev/null +++ b/srcpkgs/sagemath/patches/40594-Fix_segfault_in_libgap.patch @@ -0,0 +1,51 @@ +diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx +index f52a73c2ded..2ef40fd0a69 100644 +--- a/src/sage/libs/gap/element.pyx ++++ b/src/sage/libs/gap/element.pyx +@@ -2498,11 +2498,17 @@ cdef class GapElement_Function(GapElement): + cdef Obj result = NULL + cdef Obj arg_list + cdef int n = len(args) +- cdef volatile Obj v2 +- +- if n > 0 and n <= 3: +- libgap = self.parent() +- a = [x if isinstance(x, GapElement) else libgap(x) for x in args] ++ cdef Obj a[3] ++ ++ if n <= 3: ++ if not all(isinstance(x, GapElement) for x in args): ++ libgap = self.parent() ++ args = tuple(x if isinstance(x, GapElement) else libgap(x) for x in args) ++ for i in range(n): ++ x = args[i] ++ a[i] = (x).value ++ else: ++ arg_list = make_gap_list(args) + + try: + sig_GAP_Enter() +@@ -2510,20 +2516,12 @@ cdef class GapElement_Function(GapElement): + if n == 0: + result = GAP_CallFunc0Args(self.value) + elif n == 1: +- result = GAP_CallFunc1Args(self.value, +- (a[0]).value) ++ result = GAP_CallFunc1Args(self.value, a[0]) + elif n == 2: +- result = GAP_CallFunc2Args(self.value, +- (a[0]).value, +- (a[1]).value) ++ result = GAP_CallFunc2Args(self.value, a[0], a[1]) + elif n == 3: +- v2 = (a[2]).value +- result = GAP_CallFunc3Args(self.value, +- (a[0]).value, +- (a[1]).value, +- v2) ++ result = GAP_CallFunc3Args(self.value, a[0], a[1], a[2]) + else: +- arg_list = make_gap_list(args) + result = GAP_CallFuncList(self.value, arg_list) + sig_off() + finally: diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches index c93b07701bc..d347af19d62 100755 --- a/srcpkgs/sagemath/patches/get_patches +++ b/srcpkgs/sagemath/patches/get_patches @@ -30,5 +30,5 @@ get_pr() { # run from patches dir cd $(dirname "$0") -#get_pr 39015 "sage cli" -#get_pr 39616 "ipython 9.0" +# positive review +get_pr 40594 "Fix segfault in libgap" diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template index 6a43be1527e..a2dbb08ef96 100644 --- a/srcpkgs/sagemath/template +++ b/srcpkgs/sagemath/template @@ -1,6 +1,6 @@ # Template file for 'sagemath' pkgname=sagemath -version=10.6 +version=10.7 revision=1 _pypi_version=${version/.beta/b} _pypi_version=${_pypi_version/.rc/rc} @@ -36,7 +36,7 @@ license="GPL-2.0-or-later" homepage="https://www.sagemath.org/" changelog="https://github.com/sagemath/sage/releases" distfiles="${PYPI_SITE}/s/sagemath-standard/sagemath_standard-${_pypi_version}.tar.gz" -checksum=0405b9d9f52657969418fc47488ec0cb12fd62c538e50616b11fc9d5c507f9d2 +checksum=f6ec41913a745b94e20ceae69c2c54a7c8e549b3dc8b4a01dbd874c772924149 nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima" # main repo `.../src/sage/` is `.../sage/` here