diff --git a/SOURCES/numpy-1.7.1-override-LAPACK-XERBLA.patch b/SOURCES/numpy-1.7.1-override-LAPACK-XERBLA.patch new file mode 100644 index 0000000..bc276f9 --- /dev/null +++ b/SOURCES/numpy-1.7.1-override-LAPACK-XERBLA.patch @@ -0,0 +1,278 @@ +From 34d4897596edd2c517ab57c68d55a55fde1bbcd8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Nikola=20Forr=C3=B3?= +Date: Wed, 4 Jan 2017 16:59:54 +0100 +Subject: [PATCH] Override LAPACK XERBLA + +Backported upstream commits: +374e0b4d2c6f44fdccccfefe0546b607e5291e64 +f0b2dd7d5151878f2b4b3ea20ff551b27243f27d +--- + numpy/core/blasdot/python_xerbla.c | 51 +++++++++++++++++++++++++++++++++++ + numpy/core/setup.py | 3 ++- + numpy/linalg/lapack_litemodule.c | 54 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 107 insertions(+), 1 deletion(-) + create mode 100644 numpy/core/blasdot/python_xerbla.c + +diff --git a/numpy/core/blasdot/python_xerbla.c b/numpy/core/blasdot/python_xerbla.c +new file mode 100644 +index 0000000..bdf0b90 +--- /dev/null ++++ b/numpy/core/blasdot/python_xerbla.c +@@ -0,0 +1,51 @@ ++#include "Python.h" ++ ++/* ++ * From f2c.h, this should be safe unless fortran is set to use 64 ++ * bit integers. We don't seem to have any good way to detect that. ++ */ ++typedef int integer; ++ ++/* ++ From the original manpage: ++ -------------------------- ++ XERBLA is an error handler for the LAPACK routines. ++ It is called by an LAPACK routine if an input parameter has an invalid value. ++ A message is printed and execution stops. ++ ++ Instead of printing a message and stopping the execution, a ++ ValueError is raised with the message. ++ ++ Parameters: ++ ----------- ++ srname: Subroutine name to use in error message, maximum six characters. ++ Spaces at the end are skipped. ++ info: Number of the invalid parameter. ++*/ ++ ++int xerbla_(char *srname, integer *info) ++{ ++ static const char format[] = "On entry to %.*s" \ ++ " parameter number %d had an illegal value"; ++ char buf[sizeof(format) + 6 + 4]; /* 6 for name, 4 for param. num. */ ++ ++ int len = 0; /* length of subroutine name*/ ++#ifdef WITH_THREAD ++ PyGILState_STATE save; ++#endif ++ ++ while( len<6 && srname[len]!='\0' ) ++ len++; ++ while( len && srname[len-1]==' ' ) ++ len--; ++#ifdef WITH_THREAD ++ save = PyGILState_Ensure(); ++#endif ++ PyOS_snprintf(buf, sizeof(buf), format, len, srname, *info); ++ PyErr_SetString(PyExc_ValueError, buf); ++#ifdef WITH_THREAD ++ PyGILState_Release(save); ++#endif ++ ++ return 0; ++} +diff --git a/numpy/core/setup.py b/numpy/core/setup.py +index a1000ae..495e163 100644 +--- a/numpy/core/setup.py ++++ b/numpy/core/setup.py +@@ -899,12 +899,13 @@ def configuration(parent_package='',top_path=None): + if blas_info: + if ('NO_ATLAS_INFO',1) in blas_info.get('define_macros',[]): + return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient. +- return ext.depends[:1] ++ return ext.depends[:2] + return None # no extension module will be built + + config.add_extension('_dotblas', + sources = [get_dotblas_sources], + depends = [join('blasdot','_dotblas.c'), ++ join('blasdot', 'python_xerbla.c'), + join('blasdot','cblas.h'), + ], + include_dirs = ['blasdot'], +diff --git a/numpy/linalg/lapack_litemodule.c b/numpy/linalg/lapack_litemodule.c +index cc62382..4f8cab9 100644 +--- a/numpy/linalg/lapack_litemodule.c ++++ b/numpy/linalg/lapack_litemodule.c +@@ -171,6 +171,9 @@ lapack_lite_dgeev(PyObject *NPY_UNUSED(self), PyObject *args) + FNAME(dgeev)(&jobvl,&jobvr,&n,DDATA(a),&lda,DDATA(wr),DDATA(wi), + DDATA(vl),&ldvl,DDATA(vr),&ldvr,DDATA(work),&lwork, + &info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:c,s:c,s:i,s:i,s:i,s:i,s:i,s:i}","dgeev_", + lapack_lite_status__,"jobvl",jobvl,"jobvr",jobvr, +@@ -254,6 +257,9 @@ lapack_lite_dsyevd(PyObject *NPY_UNUSED(self), PyObject *args) + lapack_lite_status__ = \ + FNAME(dsyevd)(&jobz,&uplo,&n,DDATA(a),&lda,DDATA(w),DDATA(work), + &lwork,IDATA(iwork),&liwork,&info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:c,s:c,s:i,s:i,s:i,s:i,s:i}","dsyevd_", + lapack_lite_status__,"jobz",jobz,"uplo",uplo, +@@ -341,6 +347,9 @@ lapack_lite_zheevd(PyObject *NPY_UNUSED(self), PyObject *args) + lapack_lite_status__ = \ + FNAME(zheevd)(&jobz,&uplo,&n,ZDATA(a),&lda,DDATA(w),ZDATA(work), + &lwork,DDATA(rwork),&lrwork,IDATA(iwork),&liwork,&info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:c,s:c,s:i,s:i,s:i,s:i,s:i,s:i}","zheevd_", + lapack_lite_status__,"jobz",jobz,"uplo",uplo,"n",n, +@@ -380,6 +389,9 @@ lapack_lite_dgelsd(PyObject *NPY_UNUSED(self), PyObject *args) + FNAME(dgelsd)(&m,&n,&nrhs,DDATA(a),&lda,DDATA(b),&ldb, + DDATA(s),&rcond,&rank,DDATA(work),&lwork, + IDATA(iwork),&info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:d,s:i,s:i,s:i}","dgelsd_", + lapack_lite_status__,"m",m,"n",n,"nrhs",nrhs, +@@ -407,6 +419,9 @@ lapack_lite_dgesv(PyObject *NPY_UNUSED(self), PyObject *args) + + lapack_lite_status__ = \ + FNAME(dgesv)(&n,&nrhs,DDATA(a),&lda,IDATA(ipiv),DDATA(b),&ldb,&info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i}","dgesv_", + lapack_lite_status__,"n",n,"nrhs",nrhs,"lda",lda, +@@ -446,6 +461,9 @@ lapack_lite_dgesdd(PyObject *NPY_UNUSED(self), PyObject *args) + FNAME(dgesdd)(&jobz,&m,&n,DDATA(a),&lda,DDATA(s),DDATA(u),&ldu, + DDATA(vt),&ldvt,DDATA(work),&lwork,IDATA(iwork), + &info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + if (info == 0 && lwork == -1) { + /* We need to check the result because +@@ -496,6 +514,9 @@ lapack_lite_dgetrf(PyObject *NPY_UNUSED(self), PyObject *args) + + lapack_lite_status__ = \ + FNAME(dgetrf)(&m,&n,DDATA(a),&lda,IDATA(ipiv),&info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i}","dgetrf_",lapack_lite_status__, + "m",m,"n",n,"lda",lda,"info",info); +@@ -516,6 +537,9 @@ lapack_lite_dpotrf(PyObject *NPY_UNUSED(self), PyObject *args) + + lapack_lite_status__ = \ + FNAME(dpotrf)(&uplo,&n,DDATA(a),&lda,&info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:i,s:i,s:i}","dpotrf_",lapack_lite_status__, + "n",n,"lda",lda,"info",info); +@@ -540,6 +564,9 @@ lapack_lite_dgeqrf(PyObject *NPY_UNUSED(self), PyObject *args) + lapack_lite_status__ = \ + FNAME(dgeqrf)(&m, &n, DDATA(a), &lda, DDATA(tau), + DDATA(work), &lwork, &info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i}","dgeqrf_", + lapack_lite_status__,"m",m,"n",n,"lda",lda, +@@ -562,6 +589,9 @@ lapack_lite_dorgqr(PyObject *NPY_UNUSED(self), PyObject *args) + TRY(check_object(work,NPY_DOUBLE,"work","NPY_DOUBLE","dorgqr")); + lapack_lite_status__ = \ + FNAME(dorgqr)(&m, &n, &k, DDATA(a), &lda, DDATA(tau), DDATA(work), &lwork, &info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:i}","dorgqr_",lapack_lite_status__, + "info",info); +@@ -601,6 +631,9 @@ lapack_lite_zgeev(PyObject *NPY_UNUSED(self), PyObject *args) + FNAME(zgeev)(&jobvl,&jobvr,&n,ZDATA(a),&lda,ZDATA(w),ZDATA(vl), + &ldvl,ZDATA(vr),&ldvr,ZDATA(work),&lwork, + DDATA(rwork),&info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:c,s:c,s:i,s:i,s:i,s:i,s:i,s:i}","zgeev_", + lapack_lite_status__,"jobvl",jobvl,"jobvr",jobvr, +@@ -641,6 +674,9 @@ lapack_lite_zgelsd(PyObject *NPY_UNUSED(self), PyObject *args) + lapack_lite_status__ = \ + FNAME(zgelsd)(&m,&n,&nrhs,ZDATA(a),&lda,ZDATA(b),&ldb,DDATA(s),&rcond, + &rank,ZDATA(work),&lwork,DDATA(rwork),IDATA(iwork),&info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i}","zgelsd_", + lapack_lite_status__,"m",m,"n",n,"nrhs",nrhs,"lda",lda, +@@ -667,6 +703,9 @@ lapack_lite_zgesv(PyObject *NPY_UNUSED(self), PyObject *args) + + lapack_lite_status__ = \ + FNAME(zgesv)(&n,&nrhs,ZDATA(a),&lda,IDATA(ipiv),ZDATA(b),&ldb,&info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i}","zgesv_", + lapack_lite_status__,"n",n,"nrhs",nrhs,"lda",lda, +@@ -708,6 +747,9 @@ lapack_lite_zgesdd(PyObject *NPY_UNUSED(self), PyObject *args) + FNAME(zgesdd)(&jobz,&m,&n,ZDATA(a),&lda,DDATA(s),ZDATA(u),&ldu, + ZDATA(vt),&ldvt,ZDATA(work),&lwork,DDATA(rwork), + IDATA(iwork),&info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:c,s:i,s:i,s:i,s:i,s:i,s:i,s:i}","zgesdd_", + lapack_lite_status__,"jobz",jobz,"m",m,"n",n, +@@ -732,6 +774,9 @@ lapack_lite_zgetrf(PyObject *NPY_UNUSED(self), PyObject *args) + + lapack_lite_status__ = \ + FNAME(zgetrf)(&m,&n,ZDATA(a),&lda,IDATA(ipiv),&info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i}","zgetrf_", + lapack_lite_status__,"m",m,"n",n,"lda",lda,"info",info); +@@ -751,6 +796,9 @@ lapack_lite_zpotrf(PyObject *NPY_UNUSED(self), PyObject *args) + TRY(check_object(a,NPY_CDOUBLE,"a","NPY_CDOUBLE","zpotrf")); + lapack_lite_status__ = \ + FNAME(zpotrf)(&uplo,&n,ZDATA(a),&lda,&info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:i,s:i,s:i}","zpotrf_", + lapack_lite_status__,"n",n,"lda",lda,"info",info); +@@ -774,6 +822,9 @@ lapack_lite_zgeqrf(PyObject *NPY_UNUSED(self), PyObject *args) + + lapack_lite_status__ = \ + FNAME(zgeqrf)(&m, &n, ZDATA(a), &lda, ZDATA(tau), ZDATA(work), &lwork, &info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i}","zgeqrf_",lapack_lite_status__,"m",m,"n",n,"lda",lda,"lwork",lwork,"info",info); + } +@@ -797,6 +848,9 @@ lapack_lite_zungqr(PyObject *NPY_UNUSED(self), PyObject *args) + lapack_lite_status__ = \ + FNAME(zungqr)(&m, &n, &k, ZDATA(a), &lda, ZDATA(tau), ZDATA(work), + &lwork, &info); ++ if (PyErr_Occurred()) { ++ return NULL; ++ } + + return Py_BuildValue("{s:i,s:i}","zungqr_",lapack_lite_status__, + "info",info); +-- +2.7.4 + diff --git a/SOURCES/numpy-1.7.1.f2py.patch b/SOURCES/numpy-1.7.1.f2py.patch new file mode 100644 index 0000000..d8e6ef7 --- /dev/null +++ b/SOURCES/numpy-1.7.1.f2py.patch @@ -0,0 +1,35 @@ +From 64f64b517153a6b3de48c5b911920239b3eb1e18 Mon Sep 17 00:00:00 2001 +From: "Bradley M. Froehle" +Date: Sun, 24 Feb 2013 21:31:28 -0800 +Subject: [PATCH] BUG: Choose a more unique PY_ARRAY_UNIQUE_SYMBOL in f2py. + +In a few exceptional cases where symbols are shared between different +Python modules the use of `PyArray_API` in f2py (fortranobject.h) +conflicts with the regular use of the same symbol in the multiarray +module. Generally the symptom of this conflicting use is a segfault +when importing a f2py'ed module. This occurs because the module init +code somehow overwrites the first element of `PyArray_API` with the +location of `PyArray_API`, causing a crash when +`PyArray_GetNDArrayCVersion` is called. + +Closes gh-2521. +--- + numpy/f2py/src/fortranobject.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/numpy/f2py/src/fortranobject.h b/numpy/f2py/src/fortranobject.h +index 283021a..07e810f 100644 +--- a/numpy/f2py/src/fortranobject.h ++++ b/numpy/f2py/src/fortranobject.h +@@ -9,7 +9,7 @@ extern "C" { + #ifdef FORTRANOBJECT_C + #define NO_IMPORT_ARRAY + #endif +-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API ++#define PY_ARRAY_UNIQUE_SYMBOL _npy_f2py_ARRAY_API + #include "numpy/arrayobject.h" + + /* +-- +2.7.4 + diff --git a/SPECS/numpy.spec b/SPECS/numpy.spec index 3e89086..6cc2b8b 100644 --- a/SPECS/numpy.spec +++ b/SPECS/numpy.spec @@ -6,7 +6,7 @@ Name: numpy Version: 1.7.1 -Release: 11%{?dist} +Release: 13%{?dist} Epoch: 1 Summary: A fast multidimensional array facility for Python @@ -24,6 +24,10 @@ Source0: http://downloads.sourceforge.net/numpy/%{name}-%{version}%{?relc Patch0: CVE-2014-1858-CVE-2014-1859.patch # bz1125621 Patch1: numpy-1.8.1.ppc64le.patch +# bz1167156 +Patch2: numpy-1.7.1.f2py.patch +# bz1179055 +Patch3: numpy-1.7.1-override-LAPACK-XERBLA.patch BuildRequires: python2-devel lapack-devel python-setuptools gcc-gfortran atlas-devel python-nose Requires: python-nose @@ -95,6 +99,9 @@ This package includes a version of f2py that works properly with NumPy. %patch1 -p1 %endif +%patch2 -p1 +%patch3 -p1 + # workaround for rhbz#849713 # http://mail.scipy.org/pipermail/numpy-discussion/2012-July/063530.html rm numpy/distutils/command/__init__.py && touch numpy/distutils/command/__init__.py @@ -266,6 +273,14 @@ popd &> /dev/null %changelog +* Tue Jan 03 2017 nforro@redhat.com - 1:1.7.1-13 +- resolves: #1179055 + override LAPACK XERBLA + +* Thu Dec 22 2016 nforro@redhat.com - 1:1.7.1-12 +- resolves: #1167156 + fix bug in f2py leading to segfault in modules with shared symbols + * Thu Aug 07 2014 jchaloup - 1:1.7.1-11 - resolves: #1125621 support for ppc64le, taken from private-rhel-7.0-ppc64le branch