Source: libbfio Version: 20170123-5 Severity: normal Tags: upstream patch
The libbfio package fails to build from source with a segmentation fault in the testsuite as it can be seen from this build log: https://buildd.debian.org/status/fetch.php?pkg=libbfio&arch=riscv64&ver=20170123-5&stamp=1595768513&raw=0 I have tracked down the issue to the fact that the testsuite is simulating failures for the malloc, realloc, memcpy and memset. While it makes sense and it is a good idea for the two first functions, this is fundamentally broken for memcpy and memset. Both POSIX and ISO C clearly says "The memset() function shall return s; no return value is reserved to indicate an error.". On architectures where the calling convention uses the same register for the first argument and return value, the compiler doesn't save the register around the function call, as the value must be preserved for the memset and memcpy functions. This causes issues in libraries used by libbfio (glibc on riscv64) as it basically causes addresses to be changed into NULL around a function call. I have seen that Debian holds a patch to disable memory tests for some architectures. Please add least add riscv64 like in the patch below: --- libbfio-20170123/debian/patches/0002-Don-t-define-HAVE_BFIO_TEST_MEMORY-on-some-architect.patch +++ libbfio-20170123/debian/patches/0002-Don-t-define-HAVE_BFIO_TEST_MEMORY-on-some-architect.patch @@ -14,7 +14,7 @@ #if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( __clang__ ) -+#if !defined( __arm__ ) && !defined( __mips__ ) && !defined( __hppa__ ) && !defined( __sparc__ ) ++#if !defined( __arm__ ) && !defined( __mips__ ) && !defined( __hppa__ ) && !defined( __sparc__ ) && !defined(__riscv) + #define HAVE_BFIO_TEST_MEMORY 1 A better fix would be to remove the memcpy and memset wrappers that are fundamentally broken. Disabling the memory tests is a pity because the malloc and realloc tests are correct and useful. Regards, Aurelien

