Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libcerror for openSUSE:Factory checked in at 2026-05-28 17:31:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libcerror (Old) and /work/SRC/openSUSE:Factory/.libcerror.new.1937 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libcerror" Thu May 28 17:31:59 2026 rev:24 rq:1355588 version:20260527 Changes: -------- --- /work/SRC/openSUSE:Factory/libcerror/libcerror.changes 2026-05-18 17:48:27.297389062 +0200 +++ /work/SRC/openSUSE:Factory/.libcerror.new.1937/libcerror.changes 2026-05-28 17:32:02.996410303 +0200 @@ -1,0 +2,6 @@ +Thu May 28 08:48:49 UTC 2026 - Jan Engelhardt <[email protected]> + +- Update to release 20260527 + * Updates to the testsuite only + +------------------------------------------------------------------- Old: ---- libcerror-beta-20260513.tar.gz libcerror-beta-20260513.tar.gz.asc New: ---- libcerror-beta-20260527.tar.gz libcerror-beta-20260527.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libcerror.spec ++++++ --- /var/tmp/diff_new_pack.bebEhK/_old 2026-05-28 17:32:04.144457722 +0200 +++ /var/tmp/diff_new_pack.bebEhK/_new 2026-05-28 17:32:04.148457888 +0200 @@ -18,7 +18,7 @@ Name: libcerror %define lname libcerror1 -Version: 20260513 +Version: 20260527 Release: 0 Summary: Library for C error functions License: LGPL-3.0-or-later ++++++ _scmsync.obsinfo ++++++ --- /var/tmp/diff_new_pack.bebEhK/_old 2026-05-28 17:32:04.196459870 +0200 +++ /var/tmp/diff_new_pack.bebEhK/_new 2026-05-28 17:32:04.200460035 +0200 @@ -1,5 +1,5 @@ -mtime: 1779091600 -commit: 928f3587c2c1603179c9caafaaf9658a267797ba4ebfa93e45f34d1f488cd97d +mtime: 1779958148 +commit: 39000753e4890a798b22494657cdcce94f46c3fa821891fa74db032631212a1b url: https://src.opensuse.org/security-forensics/libcerror revision: master ++++++ build.specials.obscpio ++++++ ++++++ build.specials.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore --- old/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/.gitignore 2026-05-28 10:49:08.000000000 +0200 @@ -0,0 +1 @@ +.osc ++++++ libcerror-beta-20260513.tar.gz -> libcerror-beta-20260527.tar.gz ++++++ ++++ 2208 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/common/config.h new/libcerror-20260527/common/config.h --- old/libcerror-20260513/common/config.h 2026-05-18 06:59:22.000000000 +0200 +++ new/libcerror-20260527/common/config.h 2026-05-28 10:09:05.000000000 +0200 @@ -70,7 +70,7 @@ /* Define if the GNU gettext() function is already present or preinstalled. */ #define HAVE_GETTEXT 1 -/* Define to 1 if dlsym function is available in GNU dl. */ +/* Define to 1 if dlsym function is available in GNU dl */ #define HAVE_GNU_DL_DLSYM 1 /* Define if you have the iconv() function and it works. */ @@ -109,10 +109,13 @@ /* Define to 1 if you have the 'mkstemp' function. */ #define HAVE_MKSTEMP 1 -/* Define to 1 whether printf supports the conversion specifier "%jd". */ +/* Define to 1 if the compiler supports -fno-builtin-memcpy */ +/* #undef HAVE_NO_BUILTIN_MEMCPY */ + +/* Define to 1 whether printf supports the conversion specifier "%jd" */ #define HAVE_PRINTF_JD 1 -/* Define to 1 whether printf supports the conversion specifier "%zd". */ +/* Define to 1 whether printf supports the conversion specifier "%zd" */ #define HAVE_PRINTF_ZD 1 /* Define to 1 if you have the 'realloc' function. */ @@ -244,7 +247,7 @@ /* Define to 1 if you have the <wctype.h> header file. */ #define HAVE_WCTYPE_H 1 -/* Define to 1 if wide character type should be used. */ +/* Define to 1 if wide character type should be used */ /* #undef HAVE_WIDE_CHARACTER_TYPE */ /* Define to 1 if you have the <windows.h> header file. */ @@ -275,7 +278,7 @@ #define PACKAGE_NAME "libcerror" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libcerror 20260513" +#define PACKAGE_STRING "libcerror 20260527" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "libcerror" @@ -284,7 +287,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "20260513" +#define PACKAGE_VERSION "20260527" /* The size of 'int', as computed by sizeof. */ #define SIZEOF_INT 4 @@ -310,7 +313,7 @@ /* #undef STRERROR_R_CHAR_P */ /* Version number of package */ -#define VERSION "20260513" +#define VERSION "20260527" /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/common/config.h.in new/libcerror-20260527/common/config.h.in --- old/libcerror-20260513/common/config.h.in 2026-05-18 06:59:43.000000000 +0200 +++ new/libcerror-20260527/common/config.h.in 2026-05-28 10:09:01.000000000 +0200 @@ -69,7 +69,7 @@ /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT -/* Define to 1 if dlsym function is available in GNU dl. */ +/* Define to 1 if dlsym function is available in GNU dl */ #undef HAVE_GNU_DL_DLSYM /* Define if you have the iconv() function and it works. */ @@ -108,10 +108,13 @@ /* Define to 1 if you have the 'mkstemp' function. */ #undef HAVE_MKSTEMP -/* Define to 1 whether printf supports the conversion specifier "%jd". */ +/* Define to 1 if the compiler supports -fno-builtin-memcpy */ +#undef HAVE_NO_BUILTIN_MEMCPY + +/* Define to 1 whether printf supports the conversion specifier "%jd" */ #undef HAVE_PRINTF_JD -/* Define to 1 whether printf supports the conversion specifier "%zd". */ +/* Define to 1 whether printf supports the conversion specifier "%zd" */ #undef HAVE_PRINTF_ZD /* Define to 1 if you have the 'realloc' function. */ @@ -243,7 +246,7 @@ /* Define to 1 if you have the <wctype.h> header file. */ #undef HAVE_WCTYPE_H -/* Define to 1 if wide character type should be used. */ +/* Define to 1 if wide character type should be used */ #undef HAVE_WIDE_CHARACTER_TYPE /* Define to 1 if you have the <windows.h> header file. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/configure.ac new/libcerror-20260527/configure.ac --- old/libcerror-20260513/configure.ac 2026-05-18 06:59:34.000000000 +0200 +++ new/libcerror-20260527/configure.ac 2026-05-28 08:00:21.000000000 +0200 @@ -2,7 +2,7 @@ AC_INIT( [libcerror], - [20260513], + [20260527], [[email protected]]) AC_CONFIG_SRCDIR( @@ -59,6 +59,15 @@ dnl Check if DLL support is needed AX_LIBCERROR_CHECK_DLL_SUPPORT +dnl Check if asan support should be enabled +AX_TESTS_CHECK_ENABLE_ASAN + +dnl Check if ubsan support should be enabled +AX_TESTS_CHECK_ENABLE_UBSAN + +dnl Check if code coverage support should be enabled +AX_TESTS_CHECK_ENABLE_CODE_COVERAGE + dnl Check if tests required headers and functions are available AX_TESTS_CHECK_LOCAL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/dpkg/changelog new/libcerror-20260527/dpkg/changelog --- old/libcerror-20260513/dpkg/changelog 2026-05-18 06:59:46.000000000 +0200 +++ new/libcerror-20260527/dpkg/changelog 2026-05-28 10:09:05.000000000 +0200 @@ -1,5 +1,5 @@ -libcerror (20260513-1) unstable; urgency=low +libcerror (20260527-1) unstable; urgency=low * Auto-generated - -- Joachim Metz <[email protected]> Mon, 18 May 2026 06:59:46 +0200 + -- Joachim Metz <[email protected]> Thu, 28 May 2026 10:09:04 +0200 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/include/libcerror/definitions.h new/libcerror-20260527/include/libcerror/definitions.h --- old/libcerror-20260513/include/libcerror/definitions.h 2026-05-18 06:59:46.000000000 +0200 +++ new/libcerror-20260527/include/libcerror/definitions.h 2026-05-28 10:09:05.000000000 +0200 @@ -24,11 +24,11 @@ #include <libcerror/types.h> -#define LIBCERROR_VERSION 20260513 +#define LIBCERROR_VERSION 20260527 /* The libcerror version string */ -#define LIBCERROR_VERSION_STRING "20260513" +#define LIBCERROR_VERSION_STRING "20260527" /* The error domains */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/include/libcerror/extern.h new/libcerror-20260527/include/libcerror/extern.h --- old/libcerror-20260513/include/libcerror/extern.h 2026-05-18 06:59:22.000000000 +0200 +++ new/libcerror-20260527/include/libcerror/extern.h 2026-05-27 12:39:34.000000000 +0200 @@ -31,14 +31,17 @@ */ #if defined( LIBCERROR_DLL_EXPORT ) #define LIBCERROR_EXTERN __declspec(dllexport) +#define LIBCERROR_EXTERN_VARIABLE extern __declspec(dllexport) #elif defined( LIBCERROR_DLL_IMPORT ) -#define LIBCERROR_EXTERN extern __declspec(dllimport) +#define LIBCERROR_EXTERN __declspec(dllimport) +#define LIBCERROR_EXTERN_VARIABLE extern __declspec(dllimport) #else #define LIBCERROR_EXTERN extern +#define LIBCERROR_EXTERN_VARIABLE extern -#endif +#endif /* defined( LIBCERROR_DLL_EXPORT ) */ #endif /* !defined( _LIBCERROR_EXTERN_H ) */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/libcerror/libcerror.rc new/libcerror-20260527/libcerror/libcerror.rc --- old/libcerror-20260513/libcerror/libcerror.rc 2026-05-18 06:59:46.000000000 +0200 +++ new/libcerror-20260527/libcerror/libcerror.rc 2026-05-28 10:09:05.000000000 +0200 @@ -22,12 +22,12 @@ BLOCK "040904E4" BEGIN VALUE "FileDescription", "Library to support cross-platform C error functions\0" - VALUE "FileVersion", "20260513" "\0" + VALUE "FileVersion", "20260527" "\0" VALUE "InternalName", "libcerror.dll\0" VALUE "LegalCopyright", "(C) 2008-2026, Joachim Metz <[email protected]>\0" VALUE "OriginalFilename", "libcerror.dll\0" VALUE "ProductName", "libcerror\0" - VALUE "ProductVersion", "20260513" "\0" + VALUE "ProductVersion", "20260527" "\0" VALUE "Comments", "For more information visit https://github.com/libyal/libcerror/\0" END END diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/libcerror/libcerror_definitions.h new/libcerror-20260527/libcerror/libcerror_definitions.h --- old/libcerror-20260513/libcerror/libcerror_definitions.h 2026-05-18 06:59:46.000000000 +0200 +++ new/libcerror-20260527/libcerror/libcerror_definitions.h 2026-05-28 10:09:05.000000000 +0200 @@ -35,11 +35,11 @@ */ #else -#define LIBCERROR_VERSION 20260513 +#define LIBCERROR_VERSION 20260527 /* The libcerror version string */ -#define LIBCERROR_VERSION_STRING "20260513" +#define LIBCERROR_VERSION_STRING "20260527" /* The error domains */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/libcerror/libcerror_extern.h new/libcerror-20260527/libcerror/libcerror_extern.h --- old/libcerror-20260513/libcerror/libcerror_extern.h 2026-05-18 06:59:22.000000000 +0200 +++ new/libcerror-20260527/libcerror/libcerror_extern.h 2026-05-27 12:39:34.000000000 +0200 @@ -30,12 +30,6 @@ #include <libcerror/extern.h> -#if defined( __CYGWIN__ ) || defined( __MINGW32__ ) -#define LIBCERROR_EXTERN_VARIABLE extern -#else -#define LIBCERROR_EXTERN_VARIABLE LIBCERROR_EXTERN -#endif - #else #define LIBCERROR_EXTERN /* extern */ #define LIBCERROR_EXTERN_VARIABLE extern diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/libcerror/libcerror_system.c new/libcerror-20260527/libcerror/libcerror_system.c --- old/libcerror-20260513/libcerror/libcerror_system.c 2026-05-18 06:59:22.000000000 +0200 +++ new/libcerror-20260527/libcerror/libcerror_system.c 2026-05-27 20:44:45.000000000 +0200 @@ -487,19 +487,6 @@ } while( print_count <= -1 ); - if( message_size >= LIBCERROR_MESSAGE_MAXIMUM_SIZE ) - { - error_string[ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 4 ] = (system_character_t) '.'; - error_string[ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 3 ] = (system_character_t) '.'; - error_string[ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 2 ] = (system_character_t) '.'; - error_string[ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 1 ] = 0; - error_string_size = (size_t) LIBCERROR_MESSAGE_MAXIMUM_SIZE; - } - message_index = internal_error->number_of_messages - 1; - - internal_error->messages[ message_index ] = error_string; - internal_error->sizes[ message_index ] = error_string_size; - #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) memory_free( system_format_string ); @@ -507,67 +494,62 @@ system_format_string = NULL; #endif - message_size = internal_error->sizes[ message_index ]; - if( message_size < LIBCERROR_MESSAGE_MAXIMUM_SIZE ) { /* TODO move to separate helper function */ - string_index = internal_error->sizes[ message_index ] - 1; - - if( ( internal_error->messages[ message_index ] != NULL ) - && ( ( internal_error->messages[ message_index ] )[ string_index - 1 ] == (system_character_t) '.' ) ) + if( error_string != NULL ) { - string_index -= 1; - } - reallocation = memory_reallocate( - internal_error->messages[ message_index ], - sizeof( system_character_t ) * ( message_size + 13 + 512 ) ); - - if( reallocation == NULL ) - { - memory_free( - internal_error->messages[ message_index ] ); + string_index = error_string_size - 1; - internal_error->messages[ message_index ] = NULL; - - goto on_error; + if( error_string[ string_index - 1 ] == (system_character_t) '.' ) + { + string_index -= 1; + } + error_string[ string_index ] = 0; + error_string_size = string_index + 1; + + reallocation = memory_reallocate( + error_string, + sizeof( system_character_t ) * ( message_size + 13 + 512 ) ); + + if( reallocation != NULL ) + { + error_string = (system_character_t *) reallocation; + + if( system_string_copy( + &( error_string[ string_index ] ), + _SYSTEM_STRING( " with error: " ), + 13 ) != NULL ) + { + error_string_size += 13; + string_index += 13; + + print_count = libcerror_system_copy_string_from_error_number( + &( error_string[ string_index ] ), + 512, + system_error_code ); + + if( print_count != -1 ) + { + error_string_size += print_count; + } + } + } } - internal_error->messages[ message_index ] = (system_character_t *) reallocation; - - if( system_string_copy( - &( ( internal_error->messages[ message_index ] )[ string_index ] ), - _SYSTEM_STRING( " with error: " ), - 13 ) == NULL ) - { - memory_free( - internal_error->messages[ message_index ] ); - - internal_error->messages[ message_index ] = NULL; - - goto on_error; - } - internal_error->sizes[ message_index ] += 13; - string_index += 13; - - print_count = libcerror_system_copy_string_from_error_number( - &( ( internal_error->messages[ message_index ] )[ string_index ] ), - 512, - system_error_code ); - - if( print_count == -1 ) - { - goto on_error; - } - internal_error->sizes[ message_index ] += print_count; } - if( internal_error->sizes[ message_index ] >= LIBCERROR_MESSAGE_MAXIMUM_SIZE ) + if( message_size >= LIBCERROR_MESSAGE_MAXIMUM_SIZE ) { - internal_error->messages[ message_index ][ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 4 ] = (system_character_t) '.'; - internal_error->messages[ message_index ][ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 3 ] = (system_character_t) '.'; - internal_error->messages[ message_index ][ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 2 ] = (system_character_t) '.'; - internal_error->messages[ message_index ][ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 1 ] = 0; - internal_error->sizes[ message_index ] = (size_t) LIBCERROR_MESSAGE_MAXIMUM_SIZE; + error_string[ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 4 ] = (system_character_t) '.'; + error_string[ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 3 ] = (system_character_t) '.'; + error_string[ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 2 ] = (system_character_t) '.'; + error_string[ LIBCERROR_MESSAGE_MAXIMUM_SIZE - 1 ] = 0; + error_string_size = (size_t) LIBCERROR_MESSAGE_MAXIMUM_SIZE; } + message_index = internal_error->number_of_messages - 1; + + internal_error->messages[ message_index ] = error_string; + internal_error->sizes[ message_index ] = error_string_size; + return; on_error: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/libcerror.spec new/libcerror-20260527/libcerror.spec --- old/libcerror-20260513/libcerror.spec 2026-05-18 06:59:46.000000000 +0200 +++ new/libcerror-20260527/libcerror.spec 2026-05-28 10:09:05.000000000 +0200 @@ -1,5 +1,5 @@ Name: libcerror -Version: 20260513 +Version: 20260527 Release: 1 Summary: Library to support cross-platform C error functions Group: System Environment/Libraries @@ -64,6 +64,6 @@ %{_mandir}/man3/* %changelog -* Mon May 18 2026 Joachim Metz <[email protected]> 20260513-1 +* Thu May 28 2026 Joachim Metz <[email protected]> 20260527-1 - Auto-generated diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/m4/common.m4 new/libcerror-20260527/m4/common.m4 --- old/libcerror-20260513/m4/common.m4 2025-11-26 04:50:07.000000000 +0100 +++ new/libcerror-20260527/m4/common.m4 2026-05-28 07:25:41.000000000 +0200 @@ -1,6 +1,6 @@ dnl Checks for common headers and functions dnl -dnl Version: 20241013 +dnl Version: 20260528 dnl Function to test if a certain feature was disabled AC_DEFUN([AX_COMMON_ARG_DISABLE], @@ -50,6 +50,30 @@ [ac_cv_with_$2=$4])dnl ]) +dnl Function to detect whether a specific compiler flag can be used +dnl Note that function only supports compiler flags without a = +AC_DEFUN([AX_COMMON_CHECK_COMPILER_FLAG], + [AC_REQUIRE([AC_PROG_CC]) + + m4_define([variable_name], [ac_cv_with[]m4_translit([$1], [- ], [__])]) + + AC_MSG_CHECKING([whether $CC supports $1]) + + BACKUP_CFLAGS="$CFLAGS" + + dnl Force -Werror so Clang/GCC fail on unsupported options + CFLAGS="$CFLAGS -Werror $1" + + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[]])], + [AC_MSG_RESULT([yes]) + eval variable_name="yes"], + [AC_MSG_RESULT([no]) + eval variable_name="no"]) + + CFLAGS="$BACKUP_CFLAGS" + ]) + dnl Function to detect whether shared library support should be disabled AC_DEFUN([AX_COMMON_CHECK_DISABLE_SHARED_LIBS], [AX_COMMON_ARG_DISABLE( @@ -71,7 +95,7 @@ [AC_DEFINE( [HAVE_DEBUG_OUTPUT], [1], - [Define to 1 if debug output should be used.]) + [Define to 1 if debug output should be used]) ac_cv_enable_debug_output=yes]) ]) @@ -108,7 +132,7 @@ [AC_DEFINE( [HAVE_VERBOSE_OUTPUT], [1], - [Define to 1 if verbose output should be used.]) + [Define to 1 if verbose output should be used]) ac_cv_enable_verbose_output=yes]) ]) @@ -155,7 +179,7 @@ [AC_MSG_CHECKING( [whether printf supports the conversion specifier "%jd"]) - SAVE_CFLAGS="$CFLAGS" + BACKUP_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wall -Werror" AC_LANG_PUSH(C) @@ -164,24 +188,24 @@ [AC_LANG_PROGRAM( [[#include <stdio.h>]], [[printf( "%jd" ); ]] )], - [ac_cv_cv_have_printf_jd=no], - [ac_cv_cv_have_printf_jd=yes]) + [ac_cv_have_printf_jd=no], + [ac_cv_have_printf_jd=yes]) dnl Second try to see if compilation and linkage with a parameter succeeds AS_IF( - [test "x$ac_cv_cv_have_printf_jd" = xyes], + [test "x$ac_cv_have_printf_jd" = xyes], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/types.h> #include <stdio.h>]], [[printf( "%jd", (off_t) 10 ); ]] )], - [ac_cv_cv_have_printf_jd=yes], - [ac_cv_cv_have_printf_jd=no]) + [ac_cv_have_printf_jd=yes], + [ac_cv_have_printf_jd=no]) ]) dnl Third try to see if the program runs correctly AS_IF( - [test "x$ac_cv_cv_have_printf_jd" = xyes], + [test "x$ac_cv_have_printf_jd" = xyes], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/types.h> @@ -189,24 +213,24 @@ [[char string[ 3 ]; if( snprintf( string, 3, "%jd", (off_t) 10 ) < 0 ) return( 1 ); if( ( string[ 0 ] != '1' ) || ( string[ 1 ] != '0' ) ) return( 1 ); ]] )], - [ac_cv_cv_have_printf_jd=yes], - [ac_cv_cv_have_printf_jd=no], - [ac_cv_cv_have_printf_jd=undetermined]) + [ac_cv_have_printf_jd=yes], + [ac_cv_have_printf_jd=no], + [ac_cv_have_printf_jd=undetermined]) ]) AC_LANG_POP(C) - CFLAGS="$SAVE_CFLAGS" + CFLAGS="$BACKUP_CFLAGS" AS_IF( - [test "x$ac_cv_cv_have_printf_jd" = xyes], + [test "x$ac_cv_have_printf_jd" = xyes], [AC_MSG_RESULT( [yes]) AC_DEFINE( [HAVE_PRINTF_JD], [1], - [Define to 1 whether printf supports the conversion specifier "%jd".]) ], + [Define to 1 whether printf supports the conversion specifier "%jd"]) ], [AC_MSG_RESULT( - [$ac_cv_cv_have_printf_jd]) + [$ac_cv_have_printf_jd]) ]) ]) @@ -215,7 +239,7 @@ [AC_MSG_CHECKING( [whether printf supports the conversion specifier "%zd"]) - SAVE_CFLAGS="$CFLAGS" + BACKUP_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wall -Werror" AC_LANG_PUSH(C) @@ -224,24 +248,24 @@ [AC_LANG_PROGRAM( [[#include <stdio.h>]], [[printf( "%zd" ); ]] )], - [ac_cv_cv_have_printf_zd=no], - [ac_cv_cv_have_printf_zd=yes]) + [ac_cv_have_printf_zd=no], + [ac_cv_have_printf_zd=yes]) dnl Second try to see if compilation and linkage with a parameter succeeds AS_IF( - [test "x$ac_cv_cv_have_printf_zd" = xyes], + [test "x$ac_cv_have_printf_zd" = xyes], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/types.h> #include <stdio.h>]], [[printf( "%zd", (size_t) 10 ); ]] )], - [ac_cv_cv_have_printf_zd=yes], - [ac_cv_cv_have_printf_zd=no]) + [ac_cv_have_printf_zd=yes], + [ac_cv_have_printf_zd=no]) ]) dnl Third try to see if the program runs correctly AS_IF( - [test "x$ac_cv_cv_have_printf_zd" = xyes], + [test "x$ac_cv_have_printf_zd" = xyes], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/types.h> @@ -249,24 +273,24 @@ [[char string[ 3 ]; if( snprintf( string, 3, "%zd", (size_t) 10 ) < 0 ) return( 1 ); if( ( string[ 0 ] != '1' ) || ( string[ 1 ] != '0' ) ) return( 1 ); ]] )], - [ac_cv_cv_have_printf_zd=yes], - [ac_cv_cv_have_printf_zd=no], - [ac_cv_cv_have_printf_zd=undetermined]) + [ac_cv_have_printf_zd=yes], + [ac_cv_have_printf_zd=no], + [ac_cv_have_printf_zd=undetermined]) ]) AC_LANG_POP(C) - CFLAGS="$SAVE_CFLAGS" + CFLAGS="$BACKUP_CFLAGS" AS_IF( - [test "x$ac_cv_cv_have_printf_zd" = xyes], + [test "x$ac_cv_have_printf_zd" = xyes], [AC_MSG_RESULT( [yes]) AC_DEFINE( [HAVE_PRINTF_ZD], [1], - [Define to 1 whether printf supports the conversion specifier "%zd".]) ], + [Define to 1 whether printf supports the conversion specifier "%zd"]) ], [AC_MSG_RESULT( - [$ac_cv_cv_have_printf_zd]) + [$ac_cv_have_printf_zd]) ]) ]) @@ -288,7 +312,7 @@ AS_IF( [test "x$ac_cv_enable_winapi" = xno], [AC_CHECK_HEADERS([libintl.h]) - ]) + ]) dnl Headers included in common/types.h AC_CHECK_HEADERS([limits.h]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/m4/tests.m4 new/libcerror-20260527/m4/tests.m4 --- old/libcerror-20260513/m4/tests.m4 2024-06-01 08:12:42.000000000 +0200 +++ new/libcerror-20260527/m4/tests.m4 2026-05-28 08:29:51.000000000 +0200 @@ -1,6 +1,152 @@ dnl Functions for testing dnl -dnl Version: 20200712 +dnl Version: 20260527 + +dnl Function to check whether libasan is functional +AC_DEFUN([AX_TESTS_CHECK_LIBASAN], + [AC_MSG_CHECKING([whether libasan is functional]) + + BACKUP_CFLAGS="$CFLAGS" + BACKUP_LDFLAGS="$LDFLAGS" + + ASAN_CFLAGS="-fno-omit-frame-pointer -fsanitize=address -g -O0" + ASAN_LDFLAGS="-fsanitize=address" + + CFLAGS="$CFLAGS $ASAN_CFLAGS" + LDFLAGS="$LDFLAGS $ASAN_LDFLAGS" + + AC_LANG_PUSH(C) + + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdlib.h>]], + [[char *array = (char *) malloc(10 * sizeof(char)); +if (array == NULL) { return 0; } +array[10] = 42; +free(array);]] )], + [ac_cv_have_asan=no], + [ac_cv_have_asan=yes], + [ac_cv_have_asan=undetermined]) + + AC_LANG_POP(C) + + CFLAGS="$BACKUP_CFLAGS" + LDFLAGS="$BACKUP_LDFLAGS" + + AC_MSG_RESULT( + [$ac_cv_have_asan]) + ]) + +dnl Function to check whether libubsan is functional +AC_DEFUN([AX_TESTS_CHECK_LIBUBSAN], + [AC_MSG_CHECKING([whether libubsan is functional]) + + BACKUP_CFLAGS="$CFLAGS" + BACKUP_LDFLAGS="$LDFLAGS" + + UBSAN_CFLAGS="-fsanitize=undefined" + UBSAN_LDFLAGS="-fsanitize=undefined" + + CFLAGS="$CFLAGS $UBSAN_CFLAGS" + LDFLAGS="$LDFLAGS $UBSAN_LDFLAGS" + + AC_LANG_PUSH(C) + + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdio.h>]] + [[int shift = 1; +int negative = -5; +int result = (negative << shift);]] )], + [ac_cv_have_ubsan=no], + [ac_cv_have_ubsan=yes], + [ac_cv_have_ubsan=undetermined]) + + AC_LANG_POP(C) + + CFLAGS="$BACKUP_CFLAGS" + LDFLAGS="$BACKUP_LDFLAGS" + + AC_MSG_RESULT( + [$ac_cv_have_asan]) + ]) + +dnl Function to detect whether asan support should be enabled +AC_DEFUN([AX_TESTS_CHECK_ENABLE_ASAN], + [AX_COMMON_ARG_ENABLE( + [asan], + [asan], + [build with asan)], + [no]) + + AS_IF( + [test "x$ac_cv_enable_asan" != xno], + [AX_TESTS_CHECK_LIBASAN + + AS_IF( + [test "x$ac_cv_have_asan" = xno], + [AC_MSG_FAILURE( + [Unable to build with functional libasan], + [1]) + ]) + + CPPFLAGS="$CPPFLAGS -DHAVE_ASAN" + CFLAGS="$CFLAGS $ASAN_CFLAGS" + LDFLAGS="$LDFLAGS $ASAN_LDFLAGS" + ]) + ]) + +dnl Function to detect whether ubsan support should be enabled +AC_DEFUN([AX_TESTS_CHECK_ENABLE_UBSAN], + [AX_COMMON_ARG_ENABLE( + [ubsan], + [ubsan], + [build with ubsan)], + [no]) + + AS_IF( + [test "x$ac_cv_enable_ubsan" != xno], + [AX_TESTS_CHECK_LIBUBSAN + + AS_IF( + [test "x$ac_cv_have_ubsan" = xno], + [AC_MSG_FAILURE( + [Unable to build with functional libubsan], + [1]) + ]) + + CFLAGS="$CFLAGS $UBSAN_CFLAGS -fno-sanitize-recover=undefined" + LDFLAGS="$LDFLAGS $UBSAN_LDFLAGS" + ]) + ]) + +dnl Function to detect whether code coverage support should be enabled +AC_DEFUN([AX_TESTS_CHECK_ENABLE_CODE_COVERAGE], + [AX_COMMON_ARG_ENABLE( + [code-coverage], + [code_coverage], + [build for code coverage)], + [no]) + + AS_IF( + [test "x$ac_cv_enable_code_coverage" != xno], + [AX_COMMON_CHECK_COMPILER_FLAG(-fno-builtin-memcpy) + + AS_IF( + [test "x$ac_cv_with_fno_builtin_memcpy" != xno], + [AC_DEFINE( + [HAVE_NO_BUILTIN_MEMCPY], + [1], + [Define to 1 if the compiler supports -fno-builtin-memcpy]) + + CFLAGS="$CFLAGS --coverage -fno-builtin-memcpy -O0"], + [CFLAGS="$CFLAGS --coverage -O0"]) + + CPPFLAGS="$CPPFLAGS -DOPTIMIZATION_DISABLED" + LDFLAGS="$LDFLAGS --coverage" + + enable_shared=no]) + ]) dnl Function to detect if tests dependencies are available AC_DEFUN([AX_TESTS_CHECK_LOCAL], @@ -17,9 +163,9 @@ [AC_DEFINE( [HAVE_GNU_DL_DLSYM], [1], - [Define to 1 if dlsym function is available in GNU dl.]) + [Define to 1 if dlsym function is available in GNU dl]) + ]) ]) -]) dnl Function to detect if OSS-Fuzz build environment is available AC_DEFUN([AX_TESTS_CHECK_OSSFUZZ], @@ -29,5 +175,5 @@ AC_SUBST( [LIB_FUZZING_ENGINE], ["${LIB_FUZZING_ENGINE}"]) -]) + ]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/m4/types.m4 new/libcerror-20260527/m4/types.m4 --- old/libcerror-20260513/m4/types.m4 2024-06-01 08:12:42.000000000 +0200 +++ new/libcerror-20260527/m4/types.m4 2026-05-27 09:23:09.000000000 +0200 @@ -1,6 +1,6 @@ dnl Functions for type definitions dnl -dnl Version: 20180727 +dnl Version: 20260527 dnl Function to detect if type definitions are available AC_DEFUN([AX_TYPES_CHECK_LOCAL], @@ -13,7 +13,7 @@ [AC_DEFINE( [HAVE_WIDE_CHARACTER_TYPE], [1], - [Define to 1 if wide character type should be used.]) + [Define to 1 if wide character type should be used]) AC_SUBST( [HAVE_WIDE_CHARACTER_TYPE], [1]) ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/tests/cerror_test_error.c new/libcerror-20260527/tests/cerror_test_error.c --- old/libcerror-20260513/tests/cerror_test_error.c 2026-05-18 06:59:22.000000000 +0200 +++ new/libcerror-20260527/tests/cerror_test_error.c 2026-05-27 20:51:05.000000000 +0200 @@ -1276,11 +1276,12 @@ { char string[ 128 ]; - libcerror_error_t *error = NULL; - system_character_t **messages = NULL; - size_t *sizes = NULL; - int print_count = 0; - int result = 1; + libcerror_error_t *error = NULL; + system_character_t *error_string = NULL; + system_character_t **messages = NULL; + size_t *sizes = NULL; + int print_count = 0; + int result = 1; /* Initialize test */ @@ -1314,32 +1315,61 @@ result, 0 ); - /* Test error cases - */ + error_string = ( (libcerror_internal_error_t *) error )->messages[ 0 ]; + + ( (libcerror_internal_error_t *) error )->messages[ 0 ] = NULL; + print_count = libcerror_error_sprint( - NULL, + error, string, 128 ); + ( (libcerror_internal_error_t *) error )->messages[ 0 ] = error_string; + CERROR_TEST_ASSERT_EQUAL_INT( "print_count", print_count, - -1 ) + 0 ) + + libcerror_system_set_error( + &error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GENERIC, + 0, + "Test error." ); + + CERROR_TEST_ASSERT_IS_NOT_NULL( + "error", + error ); print_count = libcerror_error_sprint( error, - NULL, + string, 128 ); - CERROR_TEST_ASSERT_EQUAL_INT( + CERROR_TEST_ASSERT_GREATER_THAN_INT( "print_count", print_count, - -1 ) + 24 ) + + /* Note that the rest of the error message is system dependent. + */ + result = narrow_string_compare( + string, + "Test error with error: ", + 23 ); + + CERROR_TEST_ASSERT_EQUAL_INT( + "result", + result, + 0 ); + /* Test error cases + */ print_count = libcerror_error_sprint( - error, + NULL, string, - (size_t) SSIZE_MAX + 1 ); + 128 ); CERROR_TEST_ASSERT_EQUAL_INT( "print_count", @@ -1380,6 +1410,26 @@ print_count = libcerror_error_sprint( error, + NULL, + 128 ); + + CERROR_TEST_ASSERT_EQUAL_INT( + "print_count", + print_count, + -1 ) + + print_count = libcerror_error_sprint( + error, + string, + (size_t) SSIZE_MAX + 1 ); + + CERROR_TEST_ASSERT_EQUAL_INT( + "print_count", + print_count, + -1 ) + + print_count = libcerror_error_sprint( + error, string, 10 ); @@ -1388,7 +1438,7 @@ print_count, -1 ) -#if defined( HAVE_CERROR_TEST_MEMORY ) && defined( OPTIMIZATION_DISABLED ) +#if defined( HAVE_CERROR_TEST_MEMORY ) && defined( OPTIMIZATION_DISABLED ) && defined( HAVE_NO_BUILTIN_MEMCPY ) /* Test libcerror_error_sprint with memcpy returning NULL */ @@ -1413,7 +1463,7 @@ libcerror_error_free( &error ); -#endif /* defined( HAVE_CERROR_TEST_MEMORY ) && defined( OPTIMIZATION_DISABLED ) */ +#endif /* defined( HAVE_CERROR_TEST_MEMORY ) && defined( OPTIMIZATION_DISABLED ) && defined( HAVE_NO_BUILTIN_MEMCPY ) */ /* Clean up */ @@ -1443,13 +1493,14 @@ { char string[ 128 ]; - libcerror_error_t *error = NULL; - system_character_t **messages = NULL; - size_t *sizes = NULL; - const char *expected_string = NULL; - int expected_print_count = 0; - int print_count = 0; - int result = 1; + libcerror_error_t *error = NULL; + system_character_t *error_string = NULL; + system_character_t **messages = NULL; + size_t *sizes = NULL; + const char *expected_string = NULL; + int expected_print_count = 0; + int print_count = 0; + int result = 1; /* Initialize test */ @@ -1501,6 +1552,35 @@ result, 0 ); + error_string = ( (libcerror_internal_error_t *) error )->messages[ 0 ]; + + ( (libcerror_internal_error_t *) error )->messages[ 0 ] = NULL; + + print_count = libcerror_error_backtrace_sprint( + error, + string, + 128 ); + + ( (libcerror_internal_error_t *) error )->messages[ 0 ] = error_string; + + expected_string = "Test error 2."; + expected_print_count = 14; + + CERROR_TEST_ASSERT_EQUAL_INT( + "print_count", + print_count, + expected_print_count ) + + result = narrow_string_compare( + string, + expected_string, + expected_print_count - 1 ); + + CERROR_TEST_ASSERT_EQUAL_INT( + "result", + result, + 0 ); + /* Test error cases */ print_count = libcerror_error_backtrace_sprint( @@ -1578,14 +1658,14 @@ print_count = libcerror_error_backtrace_sprint( error, string, - 14 ); + 13 ); CERROR_TEST_ASSERT_EQUAL_INT( "print_count", print_count, -1 ) -#if defined( HAVE_CERROR_TEST_MEMORY ) && defined( OPTIMIZATION_DISABLED ) +#if defined( HAVE_CERROR_TEST_MEMORY ) && defined( OPTIMIZATION_DISABLED ) && defined( HAVE_NO_BUILTIN_MEMCPY ) /* Test libcerror_error_backtrace_sprint with memcpy returning NULL */ @@ -1610,7 +1690,7 @@ libcerror_error_free( &error ); -#endif /* defined( HAVE_CERROR_TEST_MEMORY ) && defined( OPTIMIZATION_DISABLED ) */ +#endif /* defined( HAVE_CERROR_TEST_MEMORY ) && defined( OPTIMIZATION_DISABLED ) && defined( HAVE_NO_BUILTIN_MEMCPY ) */ /* Clean up */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/tests/cerror_test_memory.c new/libcerror-20260527/tests/cerror_test_memory.c --- old/libcerror-20260513/tests/cerror_test_memory.c 2026-05-18 06:59:22.000000000 +0200 +++ new/libcerror-20260527/tests/cerror_test_memory.c 2026-05-27 12:39:34.000000000 +0200 @@ -35,15 +35,8 @@ #if defined( HAVE_CERROR_TEST_MEMORY ) -static void *(*cerror_test_real_malloc)(size_t) = NULL; -static void *(*cerror_test_real_memcpy)(void *, const void *, size_t) = NULL; -static void *(*cerror_test_real_memset)(void *, int, size_t) = NULL; -static void *(*cerror_test_real_realloc)(void *, size_t) = NULL; - -int cerror_test_malloc_attempts_before_fail = -1; -int cerror_test_memcpy_attempts_before_fail = -1; -int cerror_test_memset_attempts_before_fail = -1; -int cerror_test_realloc_attempts_before_fail = -1; +static void *(*cerror_test_real_malloc)(size_t) = NULL; +int cerror_test_malloc_attempts_before_fail = -1; /* Custom malloc for testing memory error cases * Note this function might fail if compiled with optimation @@ -59,6 +52,11 @@ cerror_test_real_malloc = dlsym( RTLD_NEXT, "malloc" ); + + if( cerror_test_real_malloc == NULL ) + { + return( NULL ); + } } if( cerror_test_malloc_attempts_before_fail == 0 ) { @@ -76,6 +74,9 @@ return( ptr ); } +static void *(*cerror_test_real_memcpy)(void *, const void *, size_t) = NULL; +int cerror_test_memcpy_attempts_before_fail = -1; + /* Custom memcpy for testing memory error cases * Note this function might fail if compiled with optimation and as a shared libary * Returns a pointer to newly allocated data or NULL @@ -90,6 +91,11 @@ cerror_test_real_memcpy = dlsym( RTLD_NEXT, "memcpy" ); + + if( cerror_test_real_memcpy == NULL ) + { + return( NULL ); + } } if( cerror_test_memcpy_attempts_before_fail == 0 ) { @@ -109,6 +115,9 @@ return( destination ); } +static void *(*cerror_test_real_memset)(void *, int, size_t) = NULL; +int cerror_test_memset_attempts_before_fail = -1; + /* Custom memset for testing memory error cases * Note this function might fail if compiled with optimation and as a shared libary * Returns a pointer to newly allocated data or NULL @@ -123,6 +132,11 @@ cerror_test_real_memset = dlsym( RTLD_NEXT, "memset" ); + + if( cerror_test_real_memset == NULL ) + { + return( NULL ); + } } if( cerror_test_memset_attempts_before_fail == 0 ) { @@ -142,6 +156,9 @@ return( ptr ); } +static void *(*cerror_test_real_realloc)(void *, size_t) = NULL; +int cerror_test_realloc_attempts_before_fail = -1; + /* Custom realloc for testing memory error cases * Note this function might fail if compiled with optimation * Returns a pointer to reallocated data or NULL @@ -155,6 +172,11 @@ cerror_test_real_realloc = dlsym( RTLD_NEXT, "realloc" ); + + if( cerror_test_real_realloc == NULL ) + { + return( NULL ); + } } if( cerror_test_realloc_attempts_before_fail == 0 ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/tests/cerror_test_system.c new/libcerror-20260527/tests/cerror_test_system.c --- old/libcerror-20260513/tests/cerror_test_system.c 2026-05-18 06:59:22.000000000 +0200 +++ new/libcerror-20260527/tests/cerror_test_system.c 2026-05-27 12:39:34.000000000 +0200 @@ -56,30 +56,6 @@ int cerror_test_vsnprintf_attempts_before_fail = -1; int cerror_test_vsnprintf_fail_return_value = -1; -#if !defined( WINAPI ) -#if defined( HAVE_STRERROR_R ) - -#if defined( STRERROR_R_CHAR_P ) -static char *(*cerror_test_real_strerror_r)(int, char *, size_t) = NULL; -#else -static int (*cerror_test_real_strerror_r)(int, char *, size_t) = NULL; -#endif - -int cerror_test_strerror_r_attempts_before_fail = -1; - -#elif defined( HAVE_STRERROR ) - -static char *(*cerror_test_real_strerror)(int) = NULL; - -int cerror_test_strerror_attempts_before_fail = -1; - -#endif -#endif /* !defined( WINAPI ) */ - -#endif /* defined( HAVE_CERROR_TEST_FUNCTION_HOOK ) */ - -#if defined( HAVE_CERROR_TEST_FUNCTION_HOOK ) - /* Custom vsnprintf for testing error cases * Returns the number of characters printed if successful or an error value otherwise */ @@ -96,6 +72,11 @@ cerror_test_real_vsnprintf = dlsym( RTLD_NEXT, "vsnprintf" ); + + if( cerror_test_real_vsnprintf == NULL ) + { + return( -1 ); + } } if( cerror_test_vsnprintf_attempts_before_fail == 0 ) { @@ -120,44 +101,93 @@ #if defined( HAVE_STRERROR_R ) #if defined( STRERROR_R_CHAR_P ) -/* Custom strerror_r for testing error cases +static char *(*cerror_test_real_strerror_r)(int, char *, size_t) = NULL; +#else +static int (*cerror_test_real_strerror_r)(int, char *, size_t) = NULL; +#endif + +int cerror_test_strerror_r_attempts_before_fail = -1; + +#elif defined( HAVE_STRERROR ) + +static char *(*cerror_test_real_strerror)(int) = NULL; + +int cerror_test_strerror_attempts_before_fail = -1; + +#endif +#endif /* !defined( WINAPI ) */ + +#if !defined( WINAPI ) +#if defined( HAVE_STRERROR_R ) + +#if defined( STRERROR_R_CHAR_P ) +/* Custom strerror_r (GNU implementation) for testing error cases * Returns a pointer to the error string if successfull or NULL on error */ char *strerror_r( int errnum, char *buf, size_t buflen ) +{ + char *result = NULL; + + if( cerror_test_real_strerror_r == NULL ) + { + cerror_test_real_strerror_r = dlsym( + RTLD_NEXT, + "strerror_r" ); + + if( cerror_test_real_strerror_r == NULL ) + { + return( NULL ); + } + } + if( cerror_test_strerror_r_attempts_before_fail == 0 ) + { + cerror_test_strerror_r_attempts_before_fail = -1; + + return( NULL ); + } + else if( cerror_test_strerror_r_attempts_before_fail > 0 ) + { + cerror_test_strerror_r_attempts_before_fail--; + } + result = cerror_test_real_strerror_r( + errnum, + buf, + buflen ); + + return( result ); +} #else -/* Custom strerror_r for testing error cases +/* Custom strerror_r (XSI implementation) for testing error cases * Returns 0 if successfull, or -1 or a positive integer on error */ int strerror_r( int errnum, char *buf, size_t buflen ) -#endif { -#if defined( STRERROR_R_CHAR_P ) - char *result = NULL; -#else - int result = 0; -#endif + int result = 0; if( cerror_test_real_strerror_r == NULL ) { + /* Use __xpg_strerror_r to present dlsym hooking strerror_r (GNU implementation) + */ cerror_test_real_strerror_r = dlsym( RTLD_NEXT, - "strerror_r" ); + "__xpg_strerror_r" ); + + if( cerror_test_real_strerror_r == NULL ) + { + return( -1 ); + } } if( cerror_test_strerror_r_attempts_before_fail == 0 ) { cerror_test_strerror_r_attempts_before_fail = -1; -#if defined( STRERROR_R_CHAR_P ) - return( NULL ); -#else return( -1 ); -#endif } else if( cerror_test_strerror_r_attempts_before_fail > 0 ) { @@ -170,6 +200,7 @@ return( result ); } +#endif /* defined( STRERROR_R_CHAR_P ) */ #elif defined( HAVE_STRERROR ) @@ -186,6 +217,11 @@ cerror_test_real_strerror = dlsym( RTLD_NEXT, "strerror" ); + + if( cerror_test_real_strerror == NULL ) + { + return( NULL ); + } } if( cerror_test_strerror_attempts_before_fail == 0 ) { @@ -328,12 +364,24 @@ int result = 0; + /* Test regular cases + */ + result = libcerror_system_copy_string_from_error_number( + string, + 128, + 22 ); + + CERROR_TEST_ASSERT_NOT_EQUAL_INT( + "result", + result, + -1 ); + /* Test error cases */ result = libcerror_system_copy_string_from_error_number( NULL, 128, - 0 ); + 22 ); CERROR_TEST_ASSERT_EQUAL_INT( "result", @@ -343,7 +391,7 @@ result = libcerror_system_copy_string_from_error_number( string, (size_t) INT_MAX + 1, - 0 ); + 22 ); CERROR_TEST_ASSERT_EQUAL_INT( "result", @@ -365,7 +413,7 @@ result = libcerror_system_copy_string_from_error_number( string, 128, - 0 ); + 22 ); if( cerror_test_strerror_r_attempts_before_fail != -1 ) { @@ -392,7 +440,7 @@ result = libcerror_system_copy_string_from_error_number( string, 128, - 0 ); + 22 ); if( cerror_test_strerror_attempts_before_fail != -1 ) { @@ -424,10 +472,11 @@ int cerror_test_system_set_error( void ) { - libcerror_error_t *error = NULL; - uint32_t error_code = 0; + libcerror_error_t *error = NULL; + system_character_t *error_string = NULL; + uint32_t error_code = 0; - /* Test libcerror_system_set_error + /* Test regular cases */ libcerror_system_set_error( &error, @@ -509,6 +558,46 @@ "error", error ); + /* Test libcerror_system_set_error multiple times + */ + libcerror_system_set_error( + &error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GENERIC, + error_code, + "Test error 1." ); + + CERROR_TEST_ASSERT_IS_NOT_NULL( + "error", + error ); + + error_string = ( (libcerror_internal_error_t *) error )->messages[ 0 ]; + + ( (libcerror_internal_error_t *) error )->messages[ 0 ] = NULL; + + memory_free( + error_string ); + + error_string = NULL; + + libcerror_system_set_error( + &error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GENERIC, + error_code, + "Test error 2." ); + + CERROR_TEST_ASSERT_IS_NOT_NULL( + "error", + error ); + + libcerror_error_free( + &error ); + + CERROR_TEST_ASSERT_IS_NULL( + "error", + error ); + /* Test error cases */ libcerror_system_set_error( @@ -531,14 +620,33 @@ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) - /* TODO test libcerror_error_get_system_format_string failing */ + /* TODO test libcerror_system_set_error with libcerror_error_get_system_format_string failing */ #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ - /* TODO test libcerror_error_get_system_format_string with libcerror_error_initialize failing */ - #if defined( HAVE_CERROR_TEST_MEMORY ) + /* Test libcerror_system_set_error with libcerror_error_initialize failing + */ + cerror_test_malloc_attempts_before_fail = 0; + + libcerror_system_set_error( + &error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GENERIC, + error_code, + "Test error." ); + + if( cerror_test_malloc_attempts_before_fail != -1 ) + { + cerror_test_malloc_attempts_before_fail = -1; + } + else + { + CERROR_TEST_ASSERT_IS_NULL( + "error", + error ); + } /* Test libcerror_system_set_error with libcerror_error_resize failing */ cerror_test_realloc_attempts_before_fail = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libcerror-20260513/tests/test_library.sh new/libcerror-20260527/tests/test_library.sh --- old/libcerror-20260513/tests/test_library.sh 2026-05-18 06:59:22.000000000 +0200 +++ new/libcerror-20260527/tests/test_library.sh 2026-05-27 12:39:34.000000000 +0200 @@ -89,12 +89,12 @@ INPUT_FILES+=("${TEST_SET_INPUT_DIRECTORY}/${FILENAME}") fi done < "${TEST_SET_DIRECTORY}/files" - else + else for FILENAME in ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}; do INPUT_FILES+=("${FILENAME}") done - fi + fi for INPUT_FILE in "${INPUT_FILES[@]}"; do OPTION_INPUT_FILE="${INPUT_FILE}";
