Bug#1115531: c-blosc2: FTBFS with glibc 2.42: E: Build killed with signal TERM after 60 minutes of inactivity
Aurelien Jarno
aurel32 at debian.org
Wed Sep 17 21:51:50 BST 2025
Source: c-blosc2
Version: 2.17.1+ds-1
Severity: normal
Tags: ftbfs forky sid upstream patch
Justification: fails to build from source
User: debian-glibc at lists.debian.org
Usertags: glibc-2.42
Dear maintainer,
During a rebuild of all packages in unstable with glibc 2.42 from
experimental, your package failed to build. Below you will find how the
build ends. If required, the full build log is available here:
https://people.debian.org/~aurel32/glibc-2.42/
After investigation it appears that the issue is due to pthread_create()
now setting errno to EINVAL when running on kernel < 6.13, even if it
succeed. This is perfectly allowed as explained in errno(3):
https://man7.org/linux/man-pages/man3/errno.3.html
The problem is that c-blosc2 is checking errno to check a possible error
of the strtol() function. This only works if errno is set to 0 before
the call, as explained in the cavears section of strtol(3):
https://man7.org/linux/man-pages/man3/strtol.3.html
You will find attached a simple patch to fix the problem, setting errno
to 0 before the call to strtol. An alternative is to pass endptr to the
strtol call and check for its value. The other case that can return
EINVAL, that is a not supported base, can't happen as the base is fixed.
In short it means replacing
| nthreads = strtol(envvar, NULL, 10);
| if ((errno != EINVAL)) {
by
| nthreads = strtol(envvar, &endptr, 10);
| if ((endptr != envvar)) {
I leave you choose what is the best option and report that to upstream.
About the archive rebuild: The build was made on virtual machines from
AWS, using sbuild, a reduced chroot with only build-essential packages
and glibc 2.42 from experimental.
Regards
Aurelien
--------------------------------------------------------------------------------
[...]
725: Tests run: 2
725: .. ALL TESTS PASSED
725: Tests run: 2
725: .. ALL TESTS PASSED
725: Tests run: 2
725/1369 Test #725: test_nolock ............................................... Passed 0.08 sec
test 726
Start 726: test_nthreads
726: Test command: /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/tests/test_nthreads
726: Working Directory: /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/tests
726: Test timeout computed to be: 10000000
E: Build killed with signal TERM after 60 minutes of inactivity
--------------------------------------------------------------------------------
-------------- next part --------------
diff --git a/blosc/blosc2.c b/blosc/blosc2.c
index 8ff941ae..fed68f56 100644
--- a/blosc/blosc2.c
+++ b/blosc/blosc2.c
@@ -2725,6 +2725,7 @@ int blosc2_compress(int clevel, int doshuffle, int32_t typesize,
envvar = getenv("BLOSC_CLEVEL");
if (envvar != NULL) {
long value;
+ errno = 0; /* To distinguish success/failure after call */
value = strtol(envvar, NULL, 10);
if ((errno != EINVAL) && (value >= 0)) {
clevel = (int)value;
@@ -2768,6 +2769,7 @@ int blosc2_compress(int clevel, int doshuffle, int32_t typesize,
envvar = getenv("BLOSC_TYPESIZE");
if (envvar != NULL) {
long value;
+ errno = 0; /* To distinguish success/failure after call */
value = strtol(envvar, NULL, 10);
if ((errno != EINVAL) && (value > 0)) {
typesize = (int32_t)value;
@@ -2790,6 +2792,7 @@ int blosc2_compress(int clevel, int doshuffle, int32_t typesize,
envvar = getenv("BLOSC_BLOCKSIZE");
if (envvar != NULL) {
long blocksize;
+ errno = 0; /* To distinguish success/failure after call */
blocksize = strtol(envvar, NULL, 10);
if ((errno != EINVAL) && (blocksize > 0)) {
blosc1_set_blocksize((size_t) blocksize);
@@ -2803,6 +2806,7 @@ int blosc2_compress(int clevel, int doshuffle, int32_t typesize,
envvar = getenv("BLOSC_NTHREADS");
if (envvar != NULL) {
long nthreads;
+ errno = 0; /* To distinguish success/failure after call */
nthreads = strtol(envvar, NULL, 10);
if ((errno != EINVAL) && (nthreads > 0)) {
result = blosc2_set_nthreads((int16_t) nthreads);
@@ -2986,6 +2990,7 @@ int blosc2_decompress(const void* src, int32_t srcsize, void* dest, int32_t dest
/* Check for a BLOSC_NTHREADS environment variable */
envvar = getenv("BLOSC_NTHREADS");
if (envvar != NULL) {
+ errno = 0; /* To distinguish success/failure after call */
nthreads = strtol(envvar, NULL, 10);
if ((errno != EINVAL)) {
if ((nthreads <= 0) || (nthreads > INT16_MAX)) {
@@ -4031,6 +4036,7 @@ blosc2_context* blosc2_create_cctx(blosc2_cparams cparams) {
envvar = getenv("BLOSC_TYPESIZE");
if (envvar != NULL) {
int32_t value;
+ errno = 0; /* To distinguish success/failure after call */
value = (int32_t) strtol(envvar, NULL, 10);
if ((errno != EINVAL) && (value > 0)) {
context->typesize = value;
@@ -4046,6 +4052,7 @@ blosc2_context* blosc2_create_cctx(blosc2_cparams cparams) {
envvar = getenv("BLOSC_CLEVEL");
if (envvar != NULL) {
int value;
+ errno = 0; /* To distinguish success/failure after call */
value = (int)strtol(envvar, NULL, 10);
if ((errno != EINVAL) && (value >= 0)) {
context->clevel = value;
@@ -4073,6 +4080,7 @@ blosc2_context* blosc2_create_cctx(blosc2_cparams cparams) {
envvar = getenv("BLOSC_BLOCKSIZE");
if (envvar != NULL) {
int32_t blocksize;
+ errno = 0; /* To distinguish success/failure after call */
blocksize = (int32_t) strtol(envvar, NULL, 10);
if ((errno != EINVAL) && (blocksize > 0)) {
context->blocksize = blocksize;
@@ -4086,6 +4094,7 @@ blosc2_context* blosc2_create_cctx(blosc2_cparams cparams) {
/* Check for a BLOSC_NTHREADS environment variable */
envvar = getenv("BLOSC_NTHREADS");
if (envvar != NULL) {
+ errno = 0; /* To distinguish success/failure after call */
int16_t nthreads = (int16_t) strtol(envvar, NULL, 10);
if ((errno != EINVAL) && (nthreads > 0)) {
context->nthreads = nthreads;
@@ -4174,6 +4183,7 @@ blosc2_context* blosc2_create_dctx(blosc2_dparams dparams) {
context->nthreads = dparams.nthreads;
char* envvar = getenv("BLOSC_NTHREADS");
if (envvar != NULL) {
+ errno = 0; /* To distinguish success/failure after call */
long nthreads = strtol(envvar, NULL, 10);
if ((errno != EINVAL) && (nthreads > 0)) {
context->nthreads = (int16_t) nthreads;
More information about the debian-science-maintainers
mailing list