Your message dated Fri, 22 Nov 2024 01:50:12 +0000
with message-id <e1teiog-000gjj...@fasolo.debian.org>
and subject line Bug#1086108: fixed in scipy 1.14.1-2
has caused the Debian Bug report #1086108,
regarding scipy: endless loop in expm on riscv64 due to UB float to int
conversion
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)
--
1086108: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1086108
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Source: scipy
Version: 1.13.1-5
Severity: important
Tags: ftbfs upstream
X-Debbugs-Cc: debian-med-packag...@lists.alioth.debian.org,
debian-ri...@lists.debian.org
User: debian-ri...@lists.debian.org
Usertags: riscv64
Control: affects -1 + src:nipy
Control: found -1 scipy/1.14.0-1exp5
Dear maintainer,
I have been debugging the cause of the FTBFS of nipy on riscv64. It
fails with [1]:
| nipy/core/reference/tests/test_matrix_groups.py .
| E: Build killed with signal TERM after 600 minutes of inactivity
I have been able to extract a minimal reproducer calling the SciPy expm
function:
| #!/usr/bin/python3
|
| import numpy as np
| from scipy.linalg import expm
|
| Z = np.array([[-0.83555296, 1.23536117, -0.54084919],
| [ 0.48341885, -0.55882754, -0.53693891],
| [-0.14802191, -0.43249490, 0.53730155]])
| # Z = np.random.standard_normal((3,3))
|
| orth = expm(Z - Z.T)
The original code uses np.random.standard_normal but I changed that into
a static array to always use to the same code path. Debugging further,
it happens that the pick_pade_structure() in the Cython expm support
code is relying on undefined behaviour (UB) to convert a non-finite
floating point value to int in a few places [2]. According to the C++
standard this is an undefined behaviour:
| When a finite value of real floating type is converted to an integer
| type other than _Bool, the fractional part is discarded (i.e., the
| value is truncated toward zero). If the value of the integral part
| cannot be represented by the integer type, the behavior is undefined.
On x86, the conversion returns 0, but on RISC-V it returns either
INT_MIN or INT_MAX depending on the sign of the floating point value. As
the result of this conversion is then used in a loop [3], this takes an
eternity to execute and just appears as endless.
The problem has been fixed upstream as part of the rewrite of the Cython
code into C [4][5]. For what I understand this will go into SciPy 1.15.
I am not sure how you want to get that fixed in the Debian package. I
see two options:
- Backport the upstream commits [4][5]
- Change the Cython code to check if number are finite before conversion
to int, and if not return 0.
Please tell me what do you prefer, and I will work on the corresponding
patch.
Note that the build failures on mips64el and sparc64 are very likely to
be same issue.
Regards
Aurelien
[1]
https://buildd.debian.org/status/fetch.php?pkg=nipy&arch=riscv64&ver=0.6.1-1&stamp=1729595150&raw=0
[2]
https://sources.debian.org/src/scipy/1.13.1-5/scipy/linalg/_matfuncs_expm.pyx.in/#L224
[3]
https://sources.debian.org/src/scipy/1.13.1-5/scipy/linalg/_matfuncs.py/#L345
[4] https://github.com/scipy/scipy/pull/21553
[5]
https://github.com/scipy/scipy/commit/424708ed018cae6b6584d7d992940fd39f2ebcc0
[6]
https://github.com/scipy/scipy/commit/84d4bd91213a89cc59d67dd9045625055c2cc463
--- End Message ---
--- Begin Message ---
Source: scipy
Source-Version: 1.14.1-2
Done: Drew Parsons <dpars...@debian.org>
We believe that the bug you reported is fixed in the latest version of
scipy, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 1086...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Drew Parsons <dpars...@debian.org> (supplier of updated scipy package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Format: 1.8
Date: Fri, 22 Nov 2024 00:37:01 +0100
Source: scipy
Architecture: source
Version: 1.14.1-2
Distribution: unstable
Urgency: medium
Maintainer: Debian Python Team <team+pyt...@tracker.debian.org>
Changed-By: Drew Parsons <dpars...@debian.org>
Closes: 1086108 1086956
Changes:
scipy (1.14.1-2) unstable; urgency=medium
.
* add debian patches to manage multiple python versions
- special_libsf_error_SOABI.patch builds libsf_error.so
with the python platform compatibility tag ('SOABI') appended to
the library name. libsf_error uses Python.h and is therefore not
a pure standalone C library independent of python version.
Removes need for dh_python3 --no-ext-rename.
- scipy_config_SOABI.patch adds platform compatibility tag
('SOABI') to __config__.py, which provides meson build
information about the scipy build
* debian patch scipy-ub-float-to-int.patch fixes undefined behaviour
(UB) handling in expm for riscv64. Thanks Aurelien Jarno.
Closes: #1086108.
* python3-scipy Recommends: python3-pooch. Used by the datasets
submodule. Closes: #1086956.
Checksums-Sha1:
a7f028d04292a01df88d74a28ce7a3b1687697d8 3396 scipy_1.14.1-2.dsc
a63922d20b47c07cddd6e2801a33c59cbf96a7b2 112560 scipy_1.14.1-2.debian.tar.xz
Checksums-Sha256:
dcb6603195237c81d11204746e75ef230d358188b2b884800ee4b34e21bb39b4 3396
scipy_1.14.1-2.dsc
36e9fabff8df84f95b70e07ea972ce7390564ed8ecf6969dddf6e3c2a79c6f8a 112560
scipy_1.14.1-2.debian.tar.xz
Files:
5d3fe0734bd41e41b2bfd6c5fe6dda89 3396 python optional scipy_1.14.1-2.dsc
6e0a124f0649f4632db2cbcc52359534 112560 python optional
scipy_1.14.1-2.debian.tar.xz
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEI8mpPlhYGekSbQo2Vz7x5L1aAfoFAmc/3X4ACgkQVz7x5L1a
AfqFlBAAqq/31cO+/+NcbgewVYOIX/poVgXJpOteg/qaUc2EXNWbZ8pbQwSUwJIQ
tP5fAo1P57MfTjCVmVQyrzaZLc4/DkIhoEHYOBBEFrJVPcMBnr3XXaB5y0Ksa1dm
XYeHYVZRYFUCW5ITiJF5zOsi3AotYWFvr0CM3vkn3W5haV/oTUvDnG5yikWcV6Pw
wRTVhLjvXNOFI89MrUUUopM62nLDrUuPwjlK+CD167Ao32RYLR8mxTKh39Rb5bFw
0t5Lr9xpduE6HNafL3EERUGep6D7ONWrdOH7zH4bJKX9JJqz/buGTRp8pIyYTkMK
1DVwvtewvGcf82JwPr2VgKqd68kjNwES3gFq6QGhZ4MlI5RkzidH24BHXo5j1Qa0
35Eq2JwEITOevMT/lQq1xHPAvx8EX6RsQQgnaIRpugJQsit1nqxdTOqtsuDxT4CH
owc+Sz7YsCZGiVGJbhS8hrN/xluYjYciTA8dHN+ZxODhHByxAkY0pq7j76g+0A+y
4pTf0kBmSPmYsK5dUBizLn2TgjMLDbitegRN7+i84DURykl4ey5kidc2xdskvgBb
Ra1aaVoSqvuK6d4oNwqlkdIEzo6vlmsVnv8HubZDVWhTCqIIkALhYibHna3IUynF
44Bd+1qhhYV48LkuQ1E84WAPeA3zwyEK33hprt37nafyx1Fl2xY=
=VfmN
-----END PGP SIGNATURE-----
pgpG8x6P4XjTc.pgp
Description: PGP signature
--- End Message ---