You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on enabling the concurrencykit test suite for our Alpine Linux package, I noticed that the tests fail on 32-bit architectures. More specifically, the issue is the ck_ec regression test which fails with the following error message:
This test case is supposed to check that timespec_add clamps its return values to TIME_MAX / NSEC_MAX on overflow. This is achieved by testing the return value of that function against ts_to_nanos which is defined as follows:
The type dword_t is probably supposed to mean “double word” (or something along those lines) and should presumably be twice as large (in terms of byte size) as time_t. The dword_t type is defined here:
The implicit assumption here being that time_t is a 32-bit value. However, TIME_MAX does not make this assumption and is defined over sizeof(time_t) as follows:
This causes the overflow handling of ts_to_nanos to not match the handling of timespec_add if time_t is a 64-bit value on a 32-bit architecture. This is exactly the case on musl libc based systems (like Alpine Linux) since, contrary to glibc, musl-based 32-bit systems are 2038-ready and hence use a 64-bit time_t. Therefore, the test case fails on 32-bit Alpine Linux systems:
(gdb) n
94 assert(actual.tv_sec == (time_t)(nanos / (NSEC_MAX + 1)));
(gdb) p actual
$1 = {tv_sec = 9223372036854775807, tv_nsec = 999999999}
(gdb) p nanos
$2 = 1000000999
(gdb) n
Assertion failed: actual.tv_sec == (time_t)(nanos / (NSEC_MAX + 1)) (prop_test_timeutil_add.c: test_timespec_add: 94)
I ran into this on concurrencykit 0.7.1, but this should be reproducible with current Git HEAD as well. Since __int128 cannot be used on i686 I am not sure how to best fix this...
P.S.: The same issue applies to prop_test_timeutil_add_ns.c.
The text was updated successfully, but these errors were encountered:
While working on enabling the concurrencykit test suite for our Alpine Linux package, I noticed that the tests fail on 32-bit architectures. More specifically, the issue is the
ck_ec
regression test which fails with the following error message:Within the
prop_test_timeutil_add.c
test the problem is the following test case:ck/regressions/ck_ec/validate/prop_test_timeutil_add.c
Lines 51 to 58 in a16642f
This test case is supposed to check that
timespec_add
clamps its return values toTIME_MAX
/NSEC_MAX
on overflow. This is achieved by testing the return value of that function againstts_to_nanos
which is defined as follows:ck/regressions/ck_ec/validate/prop_test_timeutil_add.c
Lines 78 to 81 in a16642f
The type
dword_t
is probably supposed to mean “double word” (or something along those lines) and should presumably be twice as large (in terms of byte size) astime_t
. Thedword_t
type is defined here:ck/regressions/ck_ec/validate/prop_test_timeutil_add.c
Lines 8 to 12 in a16642f
The implicit assumption here being that
time_t
is a 32-bit value. However,TIME_MAX
does not make this assumption and is defined oversizeof(time_t)
as follows:ck/src/ck_ec_timeutil.h
Line 9 in e18e9d0
This causes the overflow handling of
ts_to_nanos
to not match the handling oftimespec_add
iftime_t
is a 64-bit value on a 32-bit architecture. This is exactly the case on musl libc based systems (like Alpine Linux) since, contrary to glibc, musl-based 32-bit systems are 2038-ready and hence use a 64-bittime_t
. Therefore, the test case fails on 32-bit Alpine Linux systems:I ran into this on concurrencykit 0.7.1, but this should be reproducible with current Git HEAD as well. Since
__int128
cannot be used on i686 I am not sure how to best fix this...P.S.: The same issue applies to
prop_test_timeutil_add_ns.c
.The text was updated successfully, but these errors were encountered: