New package: python3-cysignals-1.11.2
This commit is contained in:
parent
4cbab8a0db
commit
9a188629ea
2 changed files with 65 additions and 0 deletions
46
srcpkgs/python3-cysignals/patches/fix-write.patch
Normal file
46
srcpkgs/python3-cysignals/patches/fix-write.patch
Normal file
|
@ -0,0 +1,46 @@
|
|||
Fix a doctest failure which triggers in i686.
|
||||
|
||||
The example is in the function `test_bad_str()` in the file `tests.pyx`.
|
||||
The test pases a bad string to `sig_str()` and then raises `SIGILL`. The
|
||||
signal handler eventually raises a Python exception which in turn raises
|
||||
a `SIGSEGV` when accessing the bad string. An error message is expected,
|
||||
but that doesn't happen.
|
||||
|
||||
Presumably the segfault happens inside some stdio function which leaves
|
||||
stdio buffers in an inconsistent state so the latter `fprintf` doesn't
|
||||
work properly. From signal-safety(7):
|
||||
|
||||
Suppose that the main program is in the middle of a call to a
|
||||
stdio function such as printf(3) where the buffer and associated
|
||||
variables have been partially updated. If, at that moment, the
|
||||
program is interrupted by a signal handler that also calls
|
||||
printf(3), then the second call to printf(3) will operate on
|
||||
inconsistent data, with unpredictable results.
|
||||
|
||||
We fix this by replacing the `fprintf` by calls to `write`, which is
|
||||
async-signal-safe according to POSIX.
|
||||
|
||||
--- a/src/cysignals/implementation.c 2022-01-16 22:36:45.143796872 +0000
|
||||
+++ b/src/cysignals/implementation.c 2022-01-17 02:22:31.196695043 +0000
|
||||
@@ -638,12 +622,15 @@
|
||||
#endif
|
||||
|
||||
if (s) {
|
||||
+ /* Using fprintf from inside a signal handler is undefined, see signal-safety(7) */
|
||||
+ const char * message =
|
||||
+ "\n"
|
||||
+ "This probably occurred because a *compiled* module has a bug\n"
|
||||
+ "in it and is not properly wrapped with sig_on(), sig_off().\n"
|
||||
+ "Python will now terminate.\n"
|
||||
+ "------------------------------------------------------------------------\n";
|
||||
+ write(2, s, strlen(s));
|
||||
+ write(2, message, strlen(message));
|
||||
- fprintf(stderr,
|
||||
- "%s\n"
|
||||
- "This probably occurred because a *compiled* module has a bug\n"
|
||||
- "in it and is not properly wrapped with sig_on(), sig_off().\n"
|
||||
- "Python will now terminate.\n", s);
|
||||
- print_sep();
|
||||
}
|
||||
|
||||
dienow:
|
19
srcpkgs/python3-cysignals/template
Normal file
19
srcpkgs/python3-cysignals/template
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Template file for 'python3-cysignals'
|
||||
pkgname=python3-cysignals
|
||||
version=1.11.2
|
||||
revision=1
|
||||
wrksrc="cysignals-${version}"
|
||||
build_style=python3-module
|
||||
hostmakedepends="python3-setuptools python3-Cython autoconf"
|
||||
makedepends="python3-devel pari-devel"
|
||||
short_desc="Interrupt and signal handling for Cython "
|
||||
maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
|
||||
license="LGPL-3.0-or-later"
|
||||
homepage="https://github.com/sagemath/cysignals"
|
||||
distfiles="${PYPI_SITE}/c/cysignals/cysignals-${version}.tar.gz"
|
||||
checksum=5858b1760fbe21848121b826b2463a67ac5a45caf3d73105497a68618c5a6fa6
|
||||
nocross=yes # runs binaries built for target
|
||||
|
||||
do_check() {
|
||||
make check
|
||||
}
|
Loading…
Reference in a new issue