summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Orlitzky <mjo@gentoo.org>2023-06-30 07:29:43 -0400
committerMichael Orlitzky <mjo@gentoo.org>2023-06-30 07:30:16 -0400
commit4b15c5b4c9dfc8a96753928dd2a73c3ffc76330c (patch)
tree1e389d5d068df75161af5d1404dacab7c40218a9 /sci-mathematics/giac
parentnet-misc/ena-driver: Fix kernel build directory (diff)
downloadgentoo-4b15c5b4c9dfc8a96753928dd2a73c3ffc76330c.tar.gz
gentoo-4b15c5b4c9dfc8a96753928dd2a73c3ffc76330c.tar.bz2
gentoo-4b15c5b4c9dfc8a96753928dd2a73c3ffc76330c.zip
sci-mathematics/giac: fix and re-enable two disabled tests.
Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
Diffstat (limited to 'sci-mathematics/giac')
-rw-r--r--sci-mathematics/giac/files/giac-1.9.0.55-disable-failing-tests.patch35
-rw-r--r--sci-mathematics/giac/files/giac-1.9.0.55-pari-2.15-test.patch10
-rw-r--r--sci-mathematics/giac/files/giac-1.9.0.55-undefined-behavior.patch62
-rw-r--r--sci-mathematics/giac/giac-1.9.0.55.ebuild3
4 files changed, 74 insertions, 36 deletions
diff --git a/sci-mathematics/giac/files/giac-1.9.0.55-disable-failing-tests.patch b/sci-mathematics/giac/files/giac-1.9.0.55-disable-failing-tests.patch
deleted file mode 100644
index fdb0cf9f0396..000000000000
--- a/sci-mathematics/giac/files/giac-1.9.0.55-disable-failing-tests.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From e9ad950f7838921b1d0c85b503d7c9668be663b6 Mon Sep 17 00:00:00 2001
-From: Michael Orlitzky <michael@orlitzky.com>
-Date: Thu, 22 Jun 2023 16:57:55 -0400
-Subject: [PATCH 1/1] check/Makefile.am: disable two failing tests.
-
-Mentioned on Github at,
-
- https://github.com/sagemath/sage/pull/35745#issuecomment-1603298668
-
-For the moment, and without more information, disabling them is the
-simplest thing to do.
----
- check/Makefile.am | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/check/Makefile.am b/check/Makefile.am
-index ef0aa03..be1260c 100644
---- a/check/Makefile.am
-+++ b/check/Makefile.am
-@@ -1,10 +1,10 @@
- TESTS = chk_integrate \
- chk_factor chk_normalize chk_partfrac chk_limit \
- chk_cas chk_geo chk_morley_demo chk_xavier \
-- chk_fhan1 chk_fhan2 chk_fhan3 chk_fhan4 chk_fhan5 \
-+ chk_fhan1 chk_fhan2 chk_fhan3 chk_fhan5 \
- chk_fhan6 chk_fhan8 chk_fhan0 \
- chk_fhan11 chk_fhan12 chk_fhan13 chk_fhan14 chk_fhan15 \
-- chk_fhan16 chk_fhan17 chk_fhan19 chk_fhan20 \
-+ chk_fhan16 chk_fhan19 chk_fhan20 \
- chk_fhan21 chk_fhan9 chk_fhan18 chk_fhan7
- EXTRA_DIST = chk_integrate chk_intinda chk_intindbo chk_intindbr \
- chk_intindc chk_intindj chk_intindm \
---
-2.39.3
-
diff --git a/sci-mathematics/giac/files/giac-1.9.0.55-pari-2.15-test.patch b/sci-mathematics/giac/files/giac-1.9.0.55-pari-2.15-test.patch
new file mode 100644
index 000000000000..956ade485edd
--- /dev/null
+++ b/sci-mathematics/giac/files/giac-1.9.0.55-pari-2.15-test.patch
@@ -0,0 +1,10 @@
+https://github.com/void-linux/void-packages/blob/master/srcpkgs/giac/patches/giac-pari-2.15-test.patch
+
+--- a/check/chk_fhan4 2018-03-13 15:27:11.000000000 -0300
++++ b/check/chk_fhan4 2022-10-14 18:51:12.604731890 -0300
+@@ -1,4 +1,5 @@
+ #! /bin/sh
+ unset LANG
++export PARI_SIZE=2048000
+ ../src/icas TP04-sol.cas > TP04.tst
+ diff TP04.tst TP04-sol.cas.out1
diff --git a/sci-mathematics/giac/files/giac-1.9.0.55-undefined-behavior.patch b/sci-mathematics/giac/files/giac-1.9.0.55-undefined-behavior.patch
new file mode 100644
index 000000000000..78eac91a5244
--- /dev/null
+++ b/sci-mathematics/giac/files/giac-1.9.0.55-undefined-behavior.patch
@@ -0,0 +1,62 @@
+From fc0fb5ba02953d6e15424ce3a2d8f5b52380ffb4 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Sun, 25 Jun 2023 13:43:35 -0400
+Subject: [PATCH 1/1] src/vecteur.cc: fix invalid vector indexing.
+
+A few places in vector.cc use the construct &buffer[n]-m where
+"buffer" is an std::vector and "n" its size. This is undefined
+behavior since the index is outside of the allowed range (0 through
+n-1). With GLIBCXX_ASSERTIONS enabled, it crashes on the out-of-
+bounds index.
+
+The most obvious fix is to use &buffer[n-1]-(m+1), which avoids the
+issue so long as n >= 1. I think this will always be the case in the
+affected code, but if I'm wrong, it can be fixed by adding a special
+case for n == 0.
+---
+ src/vecteur.cc | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/vecteur.cc b/src/vecteur.cc
+index 89b1445..c91af66 100644
+--- a/src/vecteur.cc
++++ b/src/vecteur.cc
+@@ -7998,7 +7998,7 @@ namespace giac {
+ if (convertpos){
+ int C=col+1;
+ longlong * buf=&buffer[C];
+- longlong * bufend=&buffer[cmax]-8;
++ longlong * bufend=&buffer[cmax-1]-7;
+ const int * nline=&Nline[C];
+ for (;buf<=bufend;buf+=8,nline+=8){
+ longlong x,y;
+@@ -8022,7 +8022,7 @@ namespace giac {
+ else {
+ int C=col+1;
+ longlong * buf=&buffer[C];
+- longlong * bufend=&buffer[cmax]-8;
++ longlong * bufend=&buffer[cmax-1]-7;
+ const int * nline=&Nline[C];
+ for (;buf<=bufend;buf+=8,nline+=8){
+ buf[0] -= coeff*nline[0];
+@@ -8268,7 +8268,7 @@ namespace giac {
+ }
+ #else
+ int C=col+1;
+- longlong * ptr= &buffer[C],*ptrend=&buffer[cmax]-4;
++ longlong * ptr= &buffer[C],*ptrend=&buffer[cmax-1]-3;
+ const int *ptrN=&Nline[C];
+ for (;ptr<ptrend;ptrN+=4,ptr+=4){
+ longlong x = *ptr;
+@@ -8300,7 +8300,7 @@ namespace giac {
+ }
+ else {
+ int C=col+1;
+- longlong * ptr= &buffer[C],*ptrend=&buffer[cmax]-4;
++ longlong * ptr= &buffer[C],*ptrend=&buffer[cmax-1] - 3;
+ const int *ptrN=&Nline[C];
+ for (;ptr<ptrend;ptrN+=4,ptr+=4){
+ *ptr -= coeff*(*ptrN);
+--
+2.39.3
+
diff --git a/sci-mathematics/giac/giac-1.9.0.55.ebuild b/sci-mathematics/giac/giac-1.9.0.55.ebuild
index dc56ce5cff71..287394488a2d 100644
--- a/sci-mathematics/giac/giac-1.9.0.55.ebuild
+++ b/sci-mathematics/giac/giac-1.9.0.55.ebuild
@@ -50,7 +50,8 @@ PATCHES=(
"${FILESDIR}/${PN}-1.7.0.1-gsl_lapack.patch"
"${FILESDIR}/${PN}-1.6.0-pari-2.11.patch"
"${FILESDIR}/${PN}-1.9.0.21-pari-2.15.patch"
- "${FILESDIR}/${PN}-1.9.0.55-disable-failing-tests.patch"
+ "${FILESDIR}/${PN}-1.9.0.55-pari-2.15-test.patch"
+ "${FILESDIR}/${PN}-1.9.0.55-undefined-behavior.patch"
)
REQUIRED_USE="test? ( gui )"