public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sci-mathematics/giac/files/, sci-mathematics/giac/
@ 2021-04-01 21:48 Michael Orlitzky
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Orlitzky @ 2021-04-01 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     320334104e3e56e4fff1f1f821e74f7a122dfd57
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 31 12:42:19 2021 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Apr  1 21:48:37 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=32033410

sci-mathematics/giac: new package for the Giac/Xcas math systems.

We have bugzilla requests for this package going back to 2005! The
SageMath suite has recently gained the ability to use Giac from the
system, so now is an especially good time to add it to the tree.
François Bissey has been maintaining this package for years in the
sage-on-gentoo overlay and contributing fixes upstream, so the ebuild
required only minor changes at this point. I personally thank him and
you should too.

Closes: https://bugs.gentoo.org/94539
Closes: https://bugs.gentoo.org/94542
Closes: https://bugs.gentoo.org/760684
Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 sci-mathematics/giac/Manifest                      |   1 +
 .../giac/files/giac-1.6.0-pari-2.11.patch          |  17 +++
 .../giac/files/giac-1.7.0.1-gsl_lapack.patch       |  84 +++++++++++
 sci-mathematics/giac/giac-1.7.0.1.ebuild           | 163 +++++++++++++++++++++
 sci-mathematics/giac/metadata.xml                  |  39 +++++
 5 files changed, 304 insertions(+)

diff --git a/sci-mathematics/giac/Manifest b/sci-mathematics/giac/Manifest
new file mode 100644
index 00000000000..a0c47413436
--- /dev/null
+++ b/sci-mathematics/giac/Manifest
@@ -0,0 +1 @@
+DIST giac_1.7.0-1.tar.gz 82118267 BLAKE2B a9bb4cb260bfc7ba187907d054c737aa8f5de7baf132913dac2a054e886ec632d9077a52fb1e837a1db623223199592407734857725ee4b22c775f928893bb9d SHA512 05565ee22f4d81a4149935df9a32dc78ac07d06db1555a3d951169d184c746c61cd4d57407eabeb982fb8cb5b4a82726b5a553e6a9e689517a241eb0a8726929

diff --git a/sci-mathematics/giac/files/giac-1.6.0-pari-2.11.patch b/sci-mathematics/giac/files/giac-1.6.0-pari-2.11.patch
new file mode 100644
index 00000000000..24142257a34
--- /dev/null
+++ b/sci-mathematics/giac/files/giac-1.6.0-pari-2.11.patch
@@ -0,0 +1,17 @@
+Change test output for PARI 2.11
+
+See https://trac.sagemath.org/ticket/25567
+and https://xcas.univ-grenoble-alpes.fr/forum/viewtopic.php?f=4&t=2102
+
+diff -ru a/check/TP11-sol.cas.out1 b/check/TP11-sol.cas.out1
+--- a/check/TP11-sol.cas.out1	2014-10-21 10:51:48.000000000 +0200
++++ b/check/TP11-sol.cas.out1	2018-08-07 17:04:12.528052773 +0200
+@@ -10,7 +10,7 @@
+ 1073741824000000000000000000061203284109000000000000000000000000008409,
+ 2^3*3*389*733*156904374622257604823879982847602392900751802349981470895277241,
+ "Done",
+-matrix[[2,7,1],[3,2,1],[389,2,1],[733,2,1],[156904374622257604823879982847602392900751802349981470895277241,2,matrix[[2,13,1],[3,3,1],[5,2,1],[7,2,1],[56467,2,1],[6553084925887974620811527,2,matrix[[2,5,1],[19,2,1],[71,2,1],[126823,2,1]]]]]],
++1,
+ 0,
+ [],
+ 1,

diff --git a/sci-mathematics/giac/files/giac-1.7.0.1-gsl_lapack.patch b/sci-mathematics/giac/files/giac-1.7.0.1-gsl_lapack.patch
new file mode 100644
index 00000000000..073762ec6a4
--- /dev/null
+++ b/sci-mathematics/giac/files/giac-1.7.0.1-gsl_lapack.patch
@@ -0,0 +1,84 @@
+diff --git a/configure.ac b/configure.ac
+index 44fd519..0a6bad7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -38,6 +38,7 @@ AC_LANG([C++])
+ AC_PROG_LIBTOOL
+ AC_PROG_YACC
+ AM_PROG_LEX
++PKG_PROG_PKG_CONFIG
+ AC_C_BIGENDIAN
+ 
+ dnl Check for standard C+headers
+@@ -225,47 +226,17 @@ AC_CHECK_SIZEOF(long)
+ AC_CHECK_SIZEOF(long long)
+   
+ dnl Checking for Gnu Sci Lib
+-CONFIG_GSL="yes"
+-AC_ARG_ENABLE([gsl],[
+-	AS_HELP_STRING([--enable-gsl], [Use GNU scientific library [[default=yes]]])],
+-	[ if test "x$enableval" = "xno"; then CONFIG_GSL="no"; fi], [])
+-
+-if test "$CONFIG_GSL" = "yes"; then
+-	AC_CHECK_HEADERS(gsl/gsl_blas.h)
+-	AC_CHECK_HEADERS(gsl/gsl_eigen.h)
+-	if test "$ac_cv_header_gsl_gsl_blas_h" != "yes" -o "$ac_cv_header_gsl_gsl_eigen_h" != "yes"; then
+-		CONFIG_GSL="no"
+-	fi
+-fi
+-if test "$CONFIG_GSL" = "yes"; then
+-	save_LIBS="$LIBS"
+-	AC_CHECK_LIB(gslcblas, main, [], [CONFIG_GSL="no"])
+-	AC_CHECK_LIB(gsl, gsl_sf_gamma, [], [CONFIG_GSL="no"])
+-	LIBS="$save_LIBS"
+-  fi
+-GSL_LIBS=""
+-if test "$CONFIG_GSL" = "yes"; then
+-	GSL_LIBS="-lgsl -lgslcblas"
+-  fi
+-AC_SUBST(CONFIG_GSL)
+-AC_SUBST(GSL_LIBS)
+-AM_CONDITIONAL(CONFIG_GSL, [test "$CONFIG_GSL" = "yes"])
+-  
+-CONFIG_LAPACK="yes"
+-AC_ARG_ENABLE([lapack],
+-	[AS_HELP_STRING([--enable-lapack], [Use LAPACK [[default=yes]]])],
+-	[ if test "$enableval" = "no"; then CONFIG_LAPACK="no"; fi], [])
+-  
+-if test "$CONFIG_LAPACK" = "yes"; then
+-#	AC_CHECK_LIB(f2c, main, [], [CONFIG_LAPACK="no"])
+-#	AC_CHECK_LIB(blas, main, [], [CONFIG_LAPACK="no"])
+-#	AC_CHECK_LIB(tmglib, main, [], [CONFIG_LAPACK="no"])
+-	AC_CHECK_LIB(gfortran, main)
+-	AC_CHECK_LIB(blas, main)
+-	AC_CHECK_LIB(lapack, main, [], [CONFIG_LAPACK="no"])
+-#        AX_BLAS([have_blas=yes],[have_blas=no])
+-#        AX_LAPACK([have_lapack=yes],[have_lapack=no])
+-fi
++PKG_CHECK_MODULES([GSL], [gsl],[
++    AC_DEFINE(HAVE_LIBGSL,1, [Define if gsl is installed])
++    AC_SUBST(GSL_LIBS)])
++
++PKG_CHECK_MODULES([LAPACK], [lapack],[
++    AC_DEFINE(HAVE_LIBLAPACK,1,[Define if LAPACK is installed])
++    AC_SUBST(LAPACK_LIBS)])
++
++PKG_CHECK_MODULES([BLAS], [blas],[
++    AC_DEFINE(HAVE_BLAS,1,[Define if BLAS is installed])
++    AC_SUBST(BLAS_LIBS)])
+   
+ dnl if test "$CONFIG_PARI" = "yes"; then
+ dnl                      AC_MSG_CHECKING([whether PARI is configured with pthreads])
+diff --git a/src/Makefile.am b/src/Makefile.am
+index bb77986..d385fd0 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -16,7 +16,7 @@ libgiac_la_SOURCES = input_lexer.ll sym2poly.cc gausspol.cc threaded.cc \
+   caseval.c cutils.c graphic.c libbf.c libregexp.c libunicode.c \
+   qjsgiac.c quickjs.c quickjs-libc.c js.c
+ 
+-libgiac_la_LIBADD = $(NTL_LIBS) $(COCOA_LIBS) $(PARI_LIBS) $(GSL_LIBS) 
++libgiac_la_LIBADD = $(NTL_LIBS) $(COCOA_LIBS) $(PARI_LIBS) $(GSL_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS)
+ 
+ giacincludedir = $(includedir)/giac
+ giacinclude_HEADERS = dispatch.h fraction.h gen.h desolve.h misc.h ti89.h \

diff --git a/sci-mathematics/giac/giac-1.7.0.1.ebuild b/sci-mathematics/giac/giac-1.7.0.1.ebuild
new file mode 100644
index 00000000000..78894fa8a1e
--- /dev/null
+++ b/sci-mathematics/giac/giac-1.7.0.1.ebuild
@@ -0,0 +1,163 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools flag-o-matic xdg-utils
+
+FETCH_P="${PN}_"$(ver_rs  3 '-')
+MY_PV=$(ver_cut 1-3)
+DESCRIPTION="A free C++ Computer Algebra System library and its interfaces"
+HOMEPAGE="https://www-fourier.ujf-grenoble.fr/~parisse/giac.html"
+SRC_URI="https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/${FETCH_P}.tar.gz"
+LICENSE="GPL-2"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+LANGS="el en es pt"
+IUSE="ao doc +ecm examples gc +glpk gui static-libs test"
+for X in ${LANGS} ; do
+	IUSE="${IUSE} l10n_${X}"
+done
+
+# nauty and cliquer are automagical dependencies
+RDEPEND="dev-libs/gmp:=[cxx]
+	sys-libs/readline:=
+	gui? ( x11-libs/fltk
+		media-libs/libpng:= )
+	ao? ( media-libs/libao )
+	dev-libs/mpfr:=
+	sci-libs/mpfi
+	sci-libs/gsl:=
+	sci-mathematics/pari:=[threads]
+	dev-libs/ntl:=
+	virtual/lapack
+	virtual/blas
+	net-misc/curl
+	sci-mathematics/cliquer
+	sci-mathematics/nauty
+	ecm? ( sci-mathematics/gmp-ecm )
+	glpk? ( sci-mathematics/glpk )
+	gc? ( dev-libs/boehm-gc )"
+
+DEPEND="${RDEPEND}"
+
+BDEPEND="dev-tex/hevea
+	virtual/pkgconfig
+	virtual/yacc"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-1.7.0.1-gsl_lapack.patch"
+	"${FILESDIR}/${PN}-1.6.0-pari-2.11.patch"
+)
+
+REQUIRED_USE="test? ( gui )"
+
+# The mirror restriction is due to the French documentation for which
+# "Other kind of redistributions require the consent of the copyright
+# holder."
+RESTRICT="!test? ( test ) mirror"
+
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+src_prepare(){
+	default
+	eautoreconf
+}
+
+src_configure(){
+	if use gui; then
+		append-cppflags -I$(fltk-config --includedir)
+		append-lfs-flags
+
+		# Get the big-L flags from fltk's LDFLAGS.
+		append-ldflags $(fltk-config --ldflags | sed -e 's/\(-L\S*\)\s.*/\1/')
+	fi
+
+	# Using libsamplerate is currently broken
+	#
+	# The giac build system supports --docdir, but the path /usr/share/giac/doc
+	# is hard-coded throughout the source code, so passing anything else to
+	# ./configure --docdir just causes problems. Later, we'll put things right.
+	#
+	# micropython is for specific use in an upstream project
+	econf \
+		--enable-gmpxx \
+		--disable-samplerate \
+		--disable-micropy \
+		--docdir=/usr/share/giac/doc \
+		$(use_enable static-libs static) \
+		$(use_enable gui)  \
+		$(use_enable gui png)  \
+		$(use_enable ao) \
+		$(use_enable ecm) \
+		$(use_enable glpk) \
+		$(use_enable gc)
+
+}
+
+src_install() {
+	docompress -x "/usr/share/doc/${PF}/"{aide_cas,doc,examples}
+	emake install DESTDIR="${D}"
+
+	# Move all of /usr/share/giac (which contains only documentation) to
+	# its /usr/share/doc/${PF} counterpart.
+	dodir /usr/share/doc
+	mv "${ED}"/usr/share/giac "${ED}/usr/share/doc/${PF}" || die
+
+	# and create a symlink from the original location to the new one
+	dosym "./doc/${PF}" /usr/share/giac
+
+	# This is duplicated in ${ED}/usr/share/doc/${PF}/examples
+	rm -r "${ED}/usr/share/doc/${PF}/doc/Exemples" || die
+
+	# These aren't supposed to be installed at all.
+	find "${ED}/usr/share/doc/${PF}" -type f -name 'Makefile*' -delete || die
+
+	# The French docs are not freely licensed according to the README.
+	rm -r "${ED}/usr/share/doc/${PF}/doc/fr" || die
+
+	dodoc AUTHORS ChangeLog INSTALL NEWS README TROUBLES
+	if ! use gui; then
+		rm -rf \
+			"${ED}"/usr/bin/x* \
+			"${ED}"/usr/share/application-registry \
+			"${ED}"/usr/share/applications \
+			"${ED}"/usr/share/icons \
+			|| die "failed to clean up fltk files"
+	fi
+
+	if ! use doc; then
+		rm -r "${ED}/usr/share/doc/${PF}/doc" || die "failed to remove doc directory"
+	else
+		for lang in ${LANGS}; do
+			if use l10n_$lang; then
+				dosym ../aide_cas "/usr/share/doc/${PF}/doc/${lang}/aide_cas"
+			else
+				rm -r "${ED}/usr/share/giac/doc/${lang}" \
+					|| die "failed to remove ${lang} documentation"
+			fi
+		done
+	fi
+
+	if ! use examples; then
+		rm -r "${ED}/usr/share/doc/${PF}/examples" \
+		   || die "failed to remove examples"
+	fi
+
+	find "${ED}" -type f -name '*.la' -delete || die
+}
+
+pkg_postinst(){
+	if use gui; then
+		xdg_desktop_database_update
+		xdg_icon_cache_update
+	fi
+}
+
+pkg_postrm(){
+	if use gui; then
+		xdg_desktop_database_update
+		xdg_icon_cache_update
+	fi
+}

diff --git a/sci-mathematics/giac/metadata.xml b/sci-mathematics/giac/metadata.xml
new file mode 100644
index 00000000000..3fadb3c53b0
--- /dev/null
+++ b/sci-mathematics/giac/metadata.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+
+  <maintainer type="person">
+    <email>mjo@gentoo.org</email>
+  </maintainer>
+
+  <maintainer type="person" proxied="yes">
+    <email>frp.bissey@gmail.com</email>
+    <name>Francois Bissey</name>
+  </maintainer>
+
+  <maintainer type="project" proxied="proxy">
+    <email>proxy-maint@gentoo.org</email>
+    <name>Proxy Maintainers</name>
+  </maintainer>
+
+  <maintainer type="project">
+    <email>sci-mathematics@gentoo.org</email>
+    <name>Gentoo Mathematics Project</name>
+  </maintainer>
+
+  <longdescription>
+    Giac is a free computer algebra system that can be used to perform
+    computer algebra, function graphs, interactive geometry (2-d and
+    3-d), spreadsheet and statistics, programmation. It may be used as
+    a replacement for high end graphic calculators for example on
+    netbooks (for about the same price as a calculator but with much
+    more performances).
+  </longdescription>
+
+  <use>
+    <flag name="glpk">Enable the use of <pkg>sci-mathematics/glpk</pkg></flag>
+    <flag name="ecm">Enable the use of <pkg>sci-mathematics/gmp-ecm</pkg></flag>
+    <flag name="gc">Enable garbage collection support via <pkg>dev-libs/boehm-gc</pkg></flag>
+  </use>
+
+</pkgmetadata>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sci-mathematics/giac/files/, sci-mathematics/giac/
@ 2022-10-05  1:31 Michael Orlitzky
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Orlitzky @ 2022-10-05  1:31 UTC (permalink / raw
  To: gentoo-commits

commit:     59eaf72f591d225643c4b497e1ad8d65f4f5e688
Author:     François Bissey <frp.bissey <AT> gmail <DOT> com>
AuthorDate: Tue Oct  4 21:02:30 2022 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Wed Oct  5 01:29:29 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59eaf72f

sci-mathematics/giac: pari 2.15 compat + -gui workaround

Closes: https://github.com/gentoo/gentoo/pull/27625
Closes: https://bugs.gentoo.org/875179
Signed-off-by: François Bissey <frp.bissey <AT> gmail.com>
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../giac/files/giac-1.9.0.21-pari-2.15.patch            | 17 +++++++++++++++++
 sci-mathematics/giac/giac-1.9.0.21.ebuild               |  6 ++++++
 2 files changed, 23 insertions(+)

diff --git a/sci-mathematics/giac/files/giac-1.9.0.21-pari-2.15.patch b/sci-mathematics/giac/files/giac-1.9.0.21-pari-2.15.patch
new file mode 100644
index 000000000000..c1df76ea7048
--- /dev/null
+++ b/sci-mathematics/giac/files/giac-1.9.0.21-pari-2.15.patch
@@ -0,0 +1,17 @@
+--- a/src/pari.cc
++++ b/src/pari.cc
+@@ -39,6 +39,14 @@ using namespace std;
+ #endif
+ 
+ #ifdef HAVE_LIBPARI
++#if !defined ANYARG
++// Anyarg disappeared from PARI 2.15.0
++#ifdef __cplusplus
++#  define ANYARG ...
++#else
++#  define ANYARG
++#endif
++#endif
+ 
+ #ifdef HAVE_PTHREAD_H
+ #include <pthread.h>

diff --git a/sci-mathematics/giac/giac-1.9.0.21.ebuild b/sci-mathematics/giac/giac-1.9.0.21.ebuild
index bf7ed2bdb24c..a079e6b8a510 100644
--- a/sci-mathematics/giac/giac-1.9.0.21.ebuild
+++ b/sci-mathematics/giac/giac-1.9.0.21.ebuild
@@ -49,6 +49,7 @@ BDEPEND="dev-tex/hevea
 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"
 )
 
 REQUIRED_USE="test? ( gui )"
@@ -74,6 +75,11 @@ src_configure() {
 
 		# Get the big-L flags from fltk's LDFLAGS.
 		append-ldflags $(fltk-config --ldflags | sed -e 's/\(-L\S*\)\s.*/\1/')
+	else
+		# see https://trac.sagemath.org/ticket/31563#comment:91 onwards.
+		# Unless this variable is defined a non existent function will be requested.
+		# The spelling is correct - upstream is French.
+		append-cppflags -DUSE_OBJET_BIDON=1
 	fi
 
 	# Using libsamplerate is currently broken


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sci-mathematics/giac/files/, sci-mathematics/giac/
@ 2023-06-30 11:33 Michael Orlitzky
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Orlitzky @ 2023-06-30 11:33 UTC (permalink / raw
  To: gentoo-commits

commit:     4b15c5b4c9dfc8a96753928dd2a73c3ffc76330c
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 30 11:29:43 2023 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jun 30 11:30:16 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b15c5b4

sci-mathematics/giac: fix and re-enable two disabled tests.

Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../giac-1.9.0.55-disable-failing-tests.patch      | 35 ------------
 .../giac/files/giac-1.9.0.55-pari-2.15-test.patch  | 10 ++++
 .../files/giac-1.9.0.55-undefined-behavior.patch   | 62 ++++++++++++++++++++++
 sci-mathematics/giac/giac-1.9.0.55.ebuild          |  3 +-
 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 )"


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sci-mathematics/giac/files/, sci-mathematics/giac/
@ 2024-09-06  0:35 Michael Orlitzky
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Orlitzky @ 2024-09-06  0:35 UTC (permalink / raw
  To: gentoo-commits

commit:     5b5206e3eeeb791dd49dfd0424e63cfaed0f3b3c
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Sep  5 23:51:01 2024 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Sep  5 23:51:01 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b5206e3

sci-mathematics/giac: add patch to fix GLIBCXX_ASSERTIONS crash

Closes: https://github.com/gentoo/gentoo/pull/38241
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../giac-1.9.0.995-fix-undefined-behavior.patch    | 43 ++++++++++++++++++++++
 sci-mathematics/giac/giac-1.9.0.995.ebuild         |  1 +
 2 files changed, 44 insertions(+)

diff --git a/sci-mathematics/giac/files/giac-1.9.0.995-fix-undefined-behavior.patch b/sci-mathematics/giac/files/giac-1.9.0.995-fix-undefined-behavior.patch
new file mode 100644
index 000000000000..92d37ae93fa8
--- /dev/null
+++ b/sci-mathematics/giac/files/giac-1.9.0.995-fix-undefined-behavior.patch
@@ -0,0 +1,43 @@
+From 864ecde569ce9fad636abe1135de33fdc94e6981 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Thu, 5 Sep 2024 19:49:07 -0400
+Subject: [PATCH 1/1] src/vecteur.cc: skip undefined behavior with a bounds
+ check
+
+---
+ src/vecteur.cc | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/src/vecteur.cc b/src/vecteur.cc
+index de10197..119d454 100644
+--- a/src/vecteur.cc
++++ b/src/vecteur.cc
+@@ -8490,6 +8490,17 @@ namespace giac {
+ 	  }
+ 	  else {
+ 	    int C=col+1;
++	    // mjo: C can be equal to cmax here, which makes buffer[C]
++	    // illegal. In that case, however, nothing will happen
++	    // below:
++	    //
++	    // 1. C = cmax ==> C >= (cmax-4), so the "for" loop is skipped
++	    // 2. After the "for" loop, C += ptr-&buffer[C] sets C to zero
++	    // 3. Now C = cmax means that the second "for" loop is skipped
++	    //
++	    // As a result, we can comment out this whole thing when
++	    // C = cmax to avoid a crash.
++	    if (C < cmax) {
+ 	    longlong * ptr= &buffer[C],*ptrend=&buffer[0]+cmax-4;
+ 	    const int *ptrN=&Nline[C];
+ 	    for (;ptr<ptrend;ptrN+=4,ptr+=4){
+@@ -8502,6 +8513,7 @@ namespace giac {
+ 	    for (;C<cmax;++C){
+ 	      buffer[C] -= coeff*Nline[C];   
+ 	    }
++	    }
+ 	  }
+ 	}
+ 	// copy back buffer to N[l]
+-- 
+2.44.2
+

diff --git a/sci-mathematics/giac/giac-1.9.0.995.ebuild b/sci-mathematics/giac/giac-1.9.0.995.ebuild
index 32f7faec217b..28dba8596875 100644
--- a/sci-mathematics/giac/giac-1.9.0.995.ebuild
+++ b/sci-mathematics/giac/giac-1.9.0.995.ebuild
@@ -59,6 +59,7 @@ PATCHES=(
 	"${FILESDIR}/${PN}-1.9.0.21-pari-2.15.patch"
 	"${FILESDIR}/${PN}-1.9.0.67-system-gl2ps.patch"
 	"${FILESDIR}/${P}-glibcxx-assertions.patch"
+	"${FILESDIR}/${P}-fix-undefined-behavior.patch"
 )
 
 REQUIRED_USE="test? ( gui )"


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-06  0:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06  0:35 [gentoo-commits] repo/gentoo:master commit in: sci-mathematics/giac/files/, sci-mathematics/giac/ Michael Orlitzky
  -- strict thread matches above, loose matches on Subject: below --
2023-06-30 11:33 Michael Orlitzky
2022-10-05  1:31 Michael Orlitzky
2021-04-01 21:48 Michael Orlitzky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox