Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libqb for openSUSE:Factory checked in at 2023-06-21 22:37:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libqb (Old) and /work/SRC/openSUSE:Factory/.libqb.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libqb" Wed Jun 21 22:37:24 2023 rev:35 rq:1093859 version:2.0.7+20230607.06c8641 Changes: -------- --- /work/SRC/openSUSE:Factory/libqb/libqb.changes 2022-07-26 19:42:29.949655013 +0200 +++ /work/SRC/openSUSE:Factory/.libqb.new.15902/libqb.changes 2023-06-21 22:37:40.393581847 +0200 @@ -1,0 +2,12 @@ +Mon Jun 19 18:31:05 UTC 2023 - Yan Gao <y...@suse.com> + +- Update to version 2.0.7+20230607.06c8641 (v2.0.7): +- blackbox: fix potential overlow/memory corruption (gh#ClusterLabs/libqb#486) +- tests: allow -j to work (gh#ClusterLabs/libqb#485) +- strlcpy: avoid compiler warning from strncpy (gh#ClusterLabs/libqb#473) +- timer: Move state check to before time check (gh#ClusterLabs/libqb#479) +- ipc: Retry receiving credentials if the the message is short (gh#ClusterLabs/libqb#476, rh#2111711) +- lib: Fix some small bugs spotted by newest covscan (gh#ClusterLabs/libqb#471) +- doxygen2man: Fix function parameter alignment (gh#ClusterLabs/libqb#468) + +------------------------------------------------------------------- Old: ---- libqb-2.0.6+20220323.758044b.tar.xz New: ---- libqb-2.0.7+20230607.06c8641.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libqb.spec ++++++ --- /var/tmp/diff_new_pack.icoLjC/_old 2023-06-21 22:37:40.917585001 +0200 +++ /var/tmp/diff_new_pack.icoLjC/_new 2023-06-21 22:37:40.925585049 +0200 @@ -1,7 +1,7 @@ # # spec file for package libqb # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,7 +21,7 @@ %bcond_without doxygen2man Name: libqb -Version: 2.0.6+20220323.758044b +Version: 2.0.7+20230607.06c8641 Release: 0 Summary: An IPC library for high performance servers License: LGPL-2.1-or-later @@ -37,6 +37,7 @@ BuildRequires: libtool BuildRequires: pkgconfig BuildRequires: procps +BuildRequires: util-linux # Need git so build-aux/git-version-gen can extract the version number and # commit hash during autogen run (not used currently) #BuildRequires: git ++++++ _service ++++++ --- /var/tmp/diff_new_pack.icoLjC/_old 2023-06-21 22:37:40.957585242 +0200 +++ /var/tmp/diff_new_pack.icoLjC/_new 2023-06-21 22:37:40.961585265 +0200 @@ -8,10 +8,10 @@ To update to a new release, change "revision" to the desired git commit hash and bump "version" if necessary - <param name="version">2.0.6</param> + <param name="version">2.0.7</param> --> - <param name="versionformat">2.0.6+%cd.%h</param> - <param name="revision">v2.0.6</param> + <param name="versionformat">2.0.7+%cd.%h</param> + <param name="revision">v2.0.7</param> <param name="changesgenerate">enable</param> </service> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.icoLjC/_old 2023-06-21 22:37:40.981585386 +0200 +++ /var/tmp/diff_new_pack.icoLjC/_new 2023-06-21 22:37:40.985585410 +0200 @@ -5,6 +5,6 @@ </service> <service name="tar_scm"> <param name="url">https://github.com/ClusterLabs/libqb.git</param> - <param name="changesrevision">758044bed5f615c90818aa5431d00303288888e5</param></service></servicedata> + <param name="changesrevision">06c8641de2e1fef1fc6026709fb2109fbbb79d79</param></service></servicedata> (No newline at EOF) ++++++ libqb-2.0.6+20220323.758044b.tar.xz -> libqb-2.0.7+20230607.06c8641.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/Makefile.am new/libqb-2.0.7+20230607.06c8641/Makefile.am --- old/libqb-2.0.6+20220323.758044b/Makefile.am 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/Makefile.am 2023-06-07 08:50:17.000000000 +0200 @@ -39,7 +39,11 @@ dist_doc_DATA = COPYING INSTALL README.markdown -SUBDIRS = include lib doxygen2man docs tools tests examples +SUBDIRS = include lib doxygen2man docs tools examples + +if ENABLE_TESTS +SUBDIRS += tests +endif dist-clean-local: rm -f .snapshot-version autoconf automake autoheader diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/README.markdown new/libqb-2.0.7+20230607.06c8641/README.markdown --- old/libqb-2.0.6+20220323.758044b/README.markdown 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/README.markdown 2023-06-07 08:50:17.000000000 +0200 @@ -1,5 +1,7 @@ # libqb +[English](./README.markdown)|[ç®ä½ä¸æ](./README_CH.md) + ## What is libqb? libqb is a library with the primary purpose of providing high-performance, reusable features for client-server architecture, such as logging, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/README_CH.md new/libqb-2.0.7+20230607.06c8641/README_CH.md --- old/libqb-2.0.6+20220323.758044b/README_CH.md 1970-01-01 01:00:00.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/README_CH.md 2023-06-07 08:50:17.000000000 +0200 @@ -0,0 +1,63 @@ +# libqb + +**注æ**ï¼ä¸æææ¡£æå¯è½æªåæ¶æ´æ°ï¼è¯·ä»¥ææ°çè±æ[README](./README.markdown)为åã + +## libqbæ¯ä»ä¹ + +libqb æ¯ä¸ºå®¢æ·ç«¯-æå¡å¨æ¶ææä¾é«æ§è½ãå¯éç¨çåè½çåºï¼ä¾å¦æ¥å¿è®°å½ãè·è¸ªãè¿ç¨é´éä¿¡ (IPC) å轮询ã + +libqb å¹¶éæ¨å¨æä¸ºä¸ä¸ªå ç½ä¸è±¡çåºï¼èæ¯ä¸æ³¨äºæä¾é«åº¦ä¼ååç客æ·ç«¯-æå¡å¨åºç¨ç¨åºAPIï¼æ¥ä½¿å®¢æ·ç«¯-æå¡å¨åºç¨ç¨åºè¾¾å°æä½³æ§è½ã + +## å¯ä»¥éè¿å¦ä¸æ¹å¼äºè§£æ´å¤ä¿¡æ¯ + +- [libqb wiki](https://github.com/clusterlabs/libqb/wiki) + +- [Issues/Bugs](https://github.com/clusterlabs/libqb/issues) + +- [doxygençæçæå](http://clusterlabs.github.io/libqb/CURRENT/doxygen/) + +- æ¨ä¹å¯ä»¥ä½¿ç¨å¦ä¸å½ä»¤èªå·±æå»ºæå + + ```shell + $ make doxygen + $ firefox ./doc/html/index.html + ``` + +## ä¾èµ + +- glib-2.0-develï¼å¦ææ¨æ³æå»ºglibæ ·ä¾ä»£ç ï¼ + +- check-devel ï¼å¦ææ¨æ³è¿è¡æµè¯æ ·ä¾ï¼ + +- doxygen and graphviz ï¼å¦ææ¨æ³æå»ºdoxygen manæåæè htmlæåï¼ + +## 代ç 管çï¼gitï¼ + +```shell +git clone git://github.com/ClusterLabs/libqb.git +``` + +[æ¥çgithub](https://github.com/clusterlabs/libqb) + +## æºç ç¼è¯å®è£ + +```shell +$ ./autogen.sh +$ ./configure +$ make +$ sudo make install +``` + +## æ¨å¦ä½å¸®å©æä»¬ + +妿æ¨è§å¾è¿ä¸ªé¡¹ç®æç¨ï¼æ¨å¯ä»¥èèæ¯æå®çæªæ¥åå±ã æå¤ç§æ¹æ³å¯ä»¥å¯¹è¯¥é¡¹ç®æä¾æ¯æï¼ + +- æµè¯å¹¶æäº¤é®é¢ + +- å¸®å© [develo...@clusterlabs.org é®ä»¶å表](http://clusterlabs.org/mailman/listinfo/developers)ä¸çå ¶ä»äºº + +- æäº¤ææ¡£ã示ä¾åæµè¯ç¨ä¾ + +- æäº¤è¡¥ä¸ + +- æ¨å¹¿é¡¹ç® diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/configure.ac new/libqb-2.0.7+20230607.06c8641/configure.ac --- old/libqb-2.0.6+20220323.758044b/configure.ac 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/configure.ac 2023-06-07 08:50:17.000000000 +0200 @@ -1,7 +1,7 @@ # Process this file with autoconf to produce a configure script. -AC_PREREQ([2.61]) +AC_PREREQ([2.69]) dnl inject zero as a "patch" component of the version if missing in tag; dnl care to bump "X.Y.Z-yank" template below upon each release very desirable @@ -41,7 +41,7 @@ AC_CONFIG_MACRO_DIR([m4]) AC_CANONICAL_HOST -AC_PROG_LIBTOOL +LT_INIT AC_LANG([C]) dnl Fix default variables - "prefix" variable if not specified @@ -82,7 +82,7 @@ AC_PROG_CC AC_PROG_CPP AM_PROG_CC_C_O -AC_PROG_CC_C99 +m4_version_prereq([2.70], [:], [AC_PROG_CC_C99]) if test "x$ac_cv_prog_cc_c99" = "xno"; then AC_MSG_ERROR(["C99 support is required"]) fi @@ -188,7 +188,6 @@ AC_SUBST(DOXYGEN2MAN) # Checks for header files. -AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([arpa/inet.h link.h fcntl.h inttypes.h limits.h netinet/in.h \ @@ -222,8 +221,7 @@ [#include <sys/un.h>]) AC_MSG_CHECKING(looking for union semun in sys/sem.h) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[#include <sys/types.h> +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h>]], [[union semun arg; semctl(0, 0, 0, arg);]])], @@ -266,26 +264,26 @@ # Checks for defined macros AC_MSG_CHECKING(for MSG_NOSIGNAL) -AC_TRY_COMPILE([#include <sys/socket.h>], - [ int f = MSG_NOSIGNAL; ], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], + [[ int f = MSG_NOSIGNAL; ]])], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_MSG_NOSIGNAL, 1, [Define this symbol if you have MSG_NOSIGNAL])], [ AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for SO_NOSIGPIPE ) -AC_TRY_COMPILE([#include <sys/socket.h>], - [ int f = SO_NOSIGPIPE; ], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], + [[ int f = SO_NOSIGPIPE; ]])], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SO_NOSIGPIPE, 1, [Define this symbol if you have SO_NOSIGPIPE]) ], [ AC_MSG_RESULT(no)]) AC_MSG_CHECKING([for RTLD_NEXT]) -AC_TRY_COMPILE([#ifndef _GNU_SOURCE - #define _GNU_SOURCE - #endif - #include <dlfcn.h>], - [ void *h = RTLD_NEXT; ], +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifndef _GNU_SOURCE + #define _GNU_SOURCE + #endif + #include <dlfcn.h>]], + [[ void *h = RTLD_NEXT; ]])], [ AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_FAILURE_INJECTION], 1, [have failure injection]) @@ -455,12 +453,12 @@ if test -z "$gcc_has_builtin_sync_operations"; then gcc_has_builtin_sync_operations=no if test x"$GCC" = xyes && test x$have_mingw != xyes; then - AC_TRY_LINK([], - [int i; + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], + [[int i; __sync_synchronize (); __sync_bool_compare_and_swap (&i, 0, 1); __sync_fetch_and_add (&i, 1); - ], + ]])], [gcc_has_builtin_sync_operations=yes], [gcc_has_builtin_sync_operations=no]) fi @@ -479,11 +477,11 @@ if test -z "$gcc_has_builtin_atomic_operations"; then gcc_has_builtin_atomic_operations=no if test x"$GCC" = xyes && test x$have_mingw != xyes; then - AC_TRY_LINK([], - [int i; + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], + [[int i; __atomic_load_n(&i, __ATOMIC_ACQUIRE); __atomic_exchange_n(&i, 0, __ATOMIC_RELEASE); - ], + ]])], [gcc_has_builtin_atomic_operations=yes], [gcc_has_builtin_atomic_operations=no]) fi @@ -564,6 +562,11 @@ [ FORCESOCKETSFILE="$withval" ], [ FORCESOCKETSFILE="$sysconfdir/libqb/force-filesystem-sockets" ]) +AC_ARG_ENABLE([tests], + [AS_HELP_STRING([--disable-tests],[disable tests])],, + [ enable_tests="yes" ]) +AM_CONDITIONAL([ENABLE_TESTS], [test x$enable_tests = xyes]) + AC_ARG_ENABLE([install-tests], [AS_HELP_STRING([--enable-install-tests],[install tests])],, [ enable_install_tests="no" ]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/doxygen2man/doxygen2man.c new/libqb-2.0.7+20230607.06c8641/doxygen2man/doxygen2man.c --- old/libqb-2.0.6+20220323.758044b/doxygen2man/doxygen2man.c 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/doxygen2man/doxygen2man.c 2023-06-07 08:50:17.000000000 +0200 @@ -196,7 +196,9 @@ if (sub_tag->type == XML_ELEMENT_NODE && strcmp((char *)sub_tag->name, "parameterdescription") == 0 && paramname && sub_tag->children->next->children) { - paramdesc = (char*)sub_tag->children->next->children->content; + cstring_t paramdesc_c = get_text(sub_tag->children->next, NULL, NULL); + paramdesc = cstring_to_chars(paramdesc_c); + free(paramdesc_c); /* Add text to the param_map */ pi = find_param_by_name(list, paramname); @@ -539,10 +541,11 @@ * to fit after the structure member, in a style ... * well, in a style like this! */ -static void print_long_structure_comment(FILE *manfile, char *comment) +static void print_long_structure_comment(FILE *manfile, char *struct_comment) { - char *ptr = strtok(comment, " "); int column = 7; + char *comment = strdup(struct_comment); /* We're using strdup */ + char *ptr = strtok(comment, " "); fprintf(manfile, "\\fP /*"); fprintf(manfile, "\n *"); @@ -556,6 +559,7 @@ ptr = strtok(NULL, " "); } fprintf(manfile, "\n */\n"); + free(comment); } static void print_param(FILE *manfile, struct param_info *pi, int type_field_width, int name_field_width, int bold, const char *delimiter) @@ -594,8 +598,8 @@ pi->paramname?pi->paramname:"", delimiter); } else { /* Pad out so they all line up */ - int pad_length = name_field_width - - (pi->paramname?strlen(pi->paramname):0) + 1; + int pad_length = (name_field_width+2) - + (pi->paramname?strlen(pi->paramname):0) - strlen(delimiter) + 1; fprintf(manfile, " %s%-*s%s%s\\fI%s\\fP%s\\fR%*s/* %s*/\n", bold?"\\fB":"", type_field_width, type, asterisks, bold?"\\fP":"", @@ -851,7 +855,7 @@ pi = qb_list_entry(iter, struct param_info, list); if (pi->paramtype[0] != '\0') { - print_param(manfile, pi, max_param_type_len, 0, 1, ++param_num < param_count?",":""); + print_param(manfile, pi, max_param_type_len, max_param_name_len, 1, ++param_num < param_count?",":""); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/lib/Makefile.am new/libqb-2.0.7+20230607.06c8641/lib/Makefile.am --- old/libqb-2.0.6+20220323.758044b/lib/Makefile.am 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/lib/Makefile.am 2023-06-07 08:50:17.000000000 +0200 @@ -30,7 +30,7 @@ lib_LTLIBRARIES = libqb.la -libqb_la_LDFLAGS = -version-info 103:0:3 +libqb_la_LDFLAGS = -version-info 103:1:3 source_to_lint = util.c hdb.c ringbuffer.c ringbuffer_helper.c \ array.c loop.c loop_poll.c loop_job.c \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/lib/ipc_setup.c new/libqb-2.0.7+20230607.06c8641/lib/ipc_setup.c --- old/libqb-2.0.6+20220323.758044b/lib/ipc_setup.c 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/lib/ipc_setup.c 2023-06-07 08:50:17.000000000 +0200 @@ -473,11 +473,15 @@ return 0; } +#define AUTH_RECV_MAX_RETRIES 10 +#define AUTH_RECV_SLEEP_TIME_US 100 + /* Called from ipcc_connect_continue() when async connect socket is active */ int qb_ipcc_setup_connect_continue(struct qb_ipcc_connection *c, struct qb_ipc_connection_response *r) { struct ipc_auth_data *data; int32_t res; + int retry_count = 0; #ifdef QB_LINUX int off = 0; #endif @@ -486,8 +490,14 @@ qb_ipcc_us_sock_close(c->setup.u.us.sock); return -ENOMEM; } - +retry: res = qb_ipc_us_recv_msghdr(data); + if (res == -EAGAIN && ++retry_count < AUTH_RECV_MAX_RETRIES) { + struct timespec ts = {0, AUTH_RECV_SLEEP_TIME_US*QB_TIME_NS_IN_USEC}; + struct timespec ts_left = {0, 0}; + nanosleep(&ts, &ts_left); + goto retry; + } #ifdef QB_LINUX setsockopt(c->setup.u.us.sock, SOL_SOCKET, SO_PASSCRED, &off, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/lib/ipc_socket.c new/libqb-2.0.7+20230607.06c8641/lib/ipc_socket.c --- old/libqb-2.0.6+20220323.758044b/lib/ipc_socket.c 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/lib/ipc_socket.c 2023-06-07 08:50:17.000000000 +0200 @@ -183,6 +183,7 @@ int32_t write_passed = 0; int32_t read_passed = 0; char buf[max_msg_size]; + memset (buf, 0, max_msg_size); if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sockets) < 0) { qb_util_perror(LOG_DEBUG, "error calling socketpair()"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/lib/ipcs.c new/libqb-2.0.7+20230607.06c8641/lib/ipcs.c --- old/libqb-2.0.6+20220323.758044b/lib/ipcs.c 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/lib/ipcs.c 2023-06-07 08:50:17.000000000 +0200 @@ -705,7 +705,7 @@ } } - if (c && c->service->funcs.peek && c->service->funcs.reclaim) { + if (c->service->funcs.peek && c->service->funcs.reclaim) { c->service->funcs.reclaim(&c->request); } @@ -748,6 +748,11 @@ int32_t recvd = 0; ssize_t avail; + if (c == NULL) { + res = -EINVAL; + goto dispatch_cleanup; + } + if (revents & POLLNVAL) { qb_util_log(LOG_DEBUG, "NVAL conn (%s)", c->description); res = -EINVAL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/lib/log_blackbox.c new/libqb-2.0.7+20230607.06c8641/lib/log_blackbox.c --- old/libqb-2.0.6+20220323.758044b/lib/log_blackbox.c 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/lib/log_blackbox.c 2023-06-07 08:50:17.000000000 +0200 @@ -118,7 +118,6 @@ msg_len = qb_vsnprintf_serialize(chunk, QB_LOG_MAX_LEN, "Log message too long to be stored in the blackbox. "\ "Maximum is QB_LOG_MAX_LEN" , ap); - actual_size += msg_len; } actual_size += msg_len; @@ -264,6 +263,9 @@ return -EIO; } chunk = malloc(max_size); + if (!chunk) { + goto cleanup; + } do { char *ptr; @@ -342,7 +344,7 @@ int slen = strftime(time_buf, sizeof(time_buf), "%b %d %T", tm); - snprintf(time_buf+slen, sizeof(time_buf - slen), ".%03llu", timestamp.tv_nsec/QB_TIME_NS_IN_MSEC); + snprintf(time_buf+slen, sizeof(time_buf) - slen, ".%03llu", timestamp.tv_nsec/QB_TIME_NS_IN_MSEC); } else { snprintf(time_buf, sizeof(time_buf), "%ld", (long int)time_sec); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/lib/loop_timerlist.c new/libqb-2.0.7+20230607.06c8641/lib/loop_timerlist.c --- old/libqb-2.0.6+20220323.758044b/lib/loop_timerlist.c 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/lib/loop_timerlist.c 2023-06-07 08:50:17.000000000 +0200 @@ -326,10 +326,11 @@ if (res != 0) { return 0; } + if (t->state != QB_POLL_ENTRY_ACTIVE) { + return 0; + } struct timerlist_timer *timer = (struct timerlist_timer *)t->timerlist_handle; - - if (timer->is_absolute_timer) { current_ns = qb_util_nano_from_epoch_get(); } @@ -337,12 +338,6 @@ current_ns = qb_util_nano_current_get(); } uint64_t timer_ns = timerlist_expire_time(&s->timerlist, t->timerlist_handle); - /* since time estimation is racy by nature, I'll try to check the state late, - * and try to understand that no matter what, the timer might have expired in the mean time - */ - if (t->state != QB_POLL_ENTRY_ACTIVE) { - return 0; - } if (timer_ns < current_ns) { return 0; // respect the "expired" contract } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/lib/strlcpy.c new/libqb-2.0.7+20230607.06c8641/lib/strlcpy.c --- old/libqb-2.0.6+20220323.758044b/lib/strlcpy.c 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/lib/strlcpy.c 2023-06-07 08:50:17.000000000 +0200 @@ -31,14 +31,11 @@ strlcpy(char *dest, const char * src, size_t maxlen) { size_t srclen = strlen(src); - size_t len2cpy = QB_MIN(maxlen-1, srclen); - /* check maxlen separately as it could have underflowed from 0 above. */ if (maxlen) { - if (len2cpy > 0) { - strncpy(dest, src, len2cpy+1); - } - /* Always terminate, even if its empty */ + size_t len2cpy = QB_MIN(maxlen-1, srclen); + + memcpy(dest, src, len2cpy); dest[len2cpy] = '\0'; } return srclen; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/lib/unix.c new/libqb-2.0.7+20230607.06c8641/lib/unix.c --- old/libqb-2.0.6+20220323.758044b/lib/unix.c 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/lib/unix.c 2023-06-07 08:50:17.000000000 +0200 @@ -273,17 +273,18 @@ res = close(fd); if (res) { - goto cleanup_fail; + goto cleanup_fail_noclose; } *buf = addr_orig; return 0; cleanup_fail: + close(fd); +cleanup_fail_noclose: if (addr_orig) { munmap(addr_orig, bytes << 1); } - close(fd); return res; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/libqb.spec.in new/libqb-2.0.7+20230607.06c8641/libqb.spec.in --- old/libqb-2.0.6+20220323.758044b/libqb.spec.in 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/libqb.spec.in 2023-06-07 08:50:17.000000000 +0200 @@ -12,11 +12,11 @@ Summary: An IPC library for high performance servers Group: System Environment/Libraries -License: LGPLv2+ +License: LGPL-2.1-or-later URL: https://github.com/ClusterLabs/libqb Source0: https://fedorahosted.org/releases/q/u/quarterback/%{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}.tar.xz -BuildRequires: autoconf automake libtool doxygen procps check-devel +BuildRequires: autoconf automake libtool doxygen procps check-devel util-linux %description libqb provides high-performance, reusable features for client-server diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/m4/ax_pthread.m4 new/libqb-2.0.7+20230607.06c8641/m4/ax_pthread.m4 --- old/libqb-2.0.6+20220323.758044b/m4/ax_pthread.m4 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/m4/ax_pthread.m4 2023-06-07 08:50:17.000000000 +0200 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_pthread.html +# https://www.gnu.org/software/autoconf-archive/ax_pthread.html # =========================================================================== # # SYNOPSIS @@ -14,20 +14,24 @@ # flags that are needed. (The user can also force certain compiler # flags/libs to be tested by setting these environment variables.) # -# Also sets PTHREAD_CC to any special C compiler that is needed for -# multi-threaded programs (defaults to the value of CC otherwise). (This -# is necessary on AIX to use the special cc_r compiler alias.) +# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is +# needed for multi-threaded programs (defaults to the value of CC +# respectively CXX otherwise). (This is necessary on e.g. AIX to use the +# special cc_r/CC_r compiler alias.) # # NOTE: You are assumed to not only compile your program with these flags, # but also to link with them as well. For example, you might link with # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS # # If you are only building threaded programs, you may wish to use these # variables in your default LIBS, CFLAGS, and CC: # # LIBS="$PTHREAD_LIBS $LIBS" # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" # CC="$PTHREAD_CC" +# CXX="$PTHREAD_CXX" # # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant # has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to @@ -55,6 +59,7 @@ # # Copyright (c) 2008 Steven G. Johnson <stev...@alum.mit.edu> # Copyright (c) 2011 Daniel Richard G. <sk...@iskunk.org> +# Copyright (c) 2019 Marc Stevens <marc.stev...@cwi.nl> # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the @@ -67,7 +72,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. +# with this program. If not, see <https://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -82,7 +87,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 23 +#serial 31 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ @@ -104,6 +109,7 @@ ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) + AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"]) CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) @@ -123,10 +129,12 @@ # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all, and "pthread-config" -# which is a program returning the flags for the Pth emulation library. +# Create a list of thread flags to try. Items with a "," contain both +# C compiler flags (before ",") and linker flags (after ","). Other items +# starting with a "-" are C compiler flags, and remaining items are +# library names, except for "none" which indicates that we try without +# any flags at all, and "pthread-config" which is a program returning +# the flags for the Pth emulation library. ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" @@ -194,14 +202,47 @@ # that too in a future libc.) So we'll check first for the # standard Solaris way of linking pthreads (-mt -lpthread). - ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" + ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" ;; esac +# Are we compiling with Clang? + +AC_CACHE_CHECK([whether $CC is Clang], + [ax_cv_PTHREAD_CLANG], + [ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], + [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + ], + [ax_cv_PTHREAD_CLANG=yes]) + fi + ]) +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" + + # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) +# Note that for GCC and Clang -pthread generally implies -lpthread, +# except when -nostdlib is passed. +# This is problematic using libtool to build C++ shared libraries with pthread: +# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 +# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 +# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 +# To solve this, first try -pthread together with -lpthread for GCC + AS_IF([test "x$GCC" = "xyes"], - [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"]) + [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"]) + +# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first + +AS_IF([test "x$ax_pthread_clang" = "xyes"], + [ax_pthread_flags="-pthread,-lpthread -pthread"]) + # The presence of a feature test macro requesting re-entrant function # definitions is, on some systems, a strong hint that pthreads support is @@ -224,25 +265,86 @@ [ax_pthread_check_cond=0], [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) -# Are we compiling with Clang? -AC_CACHE_CHECK([whether $CC is Clang], - [ax_cv_PTHREAD_CLANG], - [ax_cv_PTHREAD_CLANG=no - # Note that Autoconf sets GCC=yes for Clang as well as GCC - if test "x$GCC" = "xyes"; then - AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], - [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ -# if defined(__clang__) && defined(__llvm__) - AX_PTHREAD_CC_IS_CLANG -# endif - ], - [ax_cv_PTHREAD_CLANG=yes]) - fi - ]) -ax_pthread_clang="$ax_cv_PTHREAD_CLANG" +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do + + case $ax_pthread_try_flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + *,*) + PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` + PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` + AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) + PTHREAD_CFLAGS="$ax_pthread_try_flag" + ;; + + pthread-config) + AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) + AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) + PTHREAD_LIBS="-l$ax_pthread_try_flag" + ;; + esac + + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h> +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void *some_global = NULL; + static void routine(void *a) + { + /* To avoid any unused-parameter or + unused-but-set-parameter warning. */ + some_global = a; + } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + AC_MSG_RESULT([$ax_pthread_ok]) + AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi -ax_pthread_clang_warning=no # Clang needs special handling, because older versions handle the -pthread # option in a rather... idiosyncratic way @@ -261,11 +363,6 @@ # -pthread does define _REENTRANT, and while the Darwin headers # ignore this macro, third-party headers might not.) - PTHREAD_CFLAGS="-pthread" - PTHREAD_LIBS= - - ax_pthread_ok=yes - # However, older versions of Clang make a point of warning the user # that, in an invocation where only linking and no compilation is # taking place, the -pthread option has no effect ("argument unused @@ -294,7 +391,7 @@ # step ax_pthread_save_ac_link="$ac_link" ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' - ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"` ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" ax_pthread_save_CFLAGS="$CFLAGS" for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do @@ -320,78 +417,7 @@ fi # $ax_pthread_clang = yes -if test "x$ax_pthread_ok" = "xno"; then -for ax_pthread_try_flag in $ax_pthread_flags; do - - case $ax_pthread_try_flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - -mt,pthread) - AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) - PTHREAD_CFLAGS="-mt" - PTHREAD_LIBS="-lpthread" - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) - PTHREAD_CFLAGS="$ax_pthread_try_flag" - ;; - pthread-config) - AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) - AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) - PTHREAD_LIBS="-l$ax_pthread_try_flag" - ;; - esac - - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h> -# if $ax_pthread_check_cond -# error "$ax_pthread_check_macro must be defined" -# endif - static void routine(void *a) { a = 0; } - static void *start_routine(void *a) { return a; }], - [pthread_t th; pthread_attr_t attr; - pthread_create(&th, 0, start_routine, 0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0) /* ; */])], - [ax_pthread_ok=yes], - []) - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - AC_MSG_RESULT([$ax_pthread_ok]) - AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi # Various other checks: if test "x$ax_pthread_ok" = "xyes"; then @@ -438,7 +464,8 @@ AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], [ax_cv_PTHREAD_PRIO_INHERIT], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], - [[int i = PTHREAD_PRIO_INHERIT;]])], + [[int i = PTHREAD_PRIO_INHERIT; + return i;]])], [ax_cv_PTHREAD_PRIO_INHERIT=yes], [ax_cv_PTHREAD_PRIO_INHERIT=no]) ]) @@ -460,18 +487,28 @@ [#handle absolute path differently from PATH based program lookup AS_CASE(["x$CC"], [x/*], - [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], - [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + [ + AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"]) + AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])]) + ], + [ + AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC]) + AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])]) + ] + ) + ]) ;; esac fi fi test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" +test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" AC_SUBST([PTHREAD_LIBS]) AC_SUBST([PTHREAD_CFLAGS]) AC_SUBST([PTHREAD_CC]) +AC_SUBST([PTHREAD_CXX]) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test "x$ax_pthread_ok" = "xyes"; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/tests/Makefile.am new/libqb-2.0.7+20230607.06c8641/tests/Makefile.am --- old/libqb-2.0.6+20220323.758044b/tests/Makefile.am 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/tests/Makefile.am 2023-06-07 08:50:17.000000000 +0200 @@ -17,9 +17,9 @@ # You should have received a copy of the GNU Lesser General Public License # along with libqb. If not, see <http://www.gnu.org/licenses/>. # -MAINTAINERCLEANFILES = Makefile.in -EXTRA_DIST = -CLEANFILES = +MAINTAINERCLEANFILES = Makefile.in auto_write_logs.c +EXTRA_DIST = make-log-test.sh sock_ipc_wrapper.test blackbox-segfault.sh resources.test start.test +CLEANFILES = $(auto_c_files) ${auto_c_files:.c=.opp} auto_write_logs.c export SOCKETDIR @@ -60,7 +60,6 @@ | MAKEFLAGS= ${MAKE} --no-print-directory -f- inst_HEADERS.var \ || echo $(inc_dir)/qb*.h*)))) auto_c_files = $(patsubst %.h,auto_check_header_%.c,$(public_headers)) -CLEANFILES += $(auto_c_files) # this works for both non/generated headers thanks to VPATH being # automatically set to $(top_srcdir)/tests and $(top_builddir) @@ -90,18 +89,8 @@ @echo "C++ compatibility tests not run" endif -CLEANFILES += ${auto_c_files:.c=.opp} - -distclean-local: - rm -rf auto_*.c - rm -rf .deps - if HAVE_DICT_WORDS if HAVE_SLOW_TESTS -EXTRA_DIST += make-log-test.sh -CLEANFILES += auto_write_logs.c -MAINTAINERCLEANFILES += auto_write_logs.c - nodist_bench_log_SOURCES = auto_write_logs.c bench_log: auto_write_logs.c @@ -116,22 +105,13 @@ libdir= $(TESTDIR) if HAVE_CHECK -libstat_wrapper_la_SOURCES = libstat_wrapper.c -libstat_wrapper_la_LIBADD = -ldl - -EXTRA_DIST += start.test resources.test ipc_sock.test -EXTRA_DIST += blackbox-segfault.sh - -TESTS = start.test array.test map.test rb.test list.test log.test blackbox-segfault.sh loop.test ipc.test ipc_sock.test resources.test +TESTS = start.test array.test map.test rb.test list.test log.test blackbox-segfault.sh loop.test ipc.test sock_ipc_wrapper.test resources.test TESTS_ENVIRONMENT = export PATH=.:../tools:$$PATH; -resources.log: rb.log log.log ipc.log - -check_PROGRAMS = array.test ipc.test list.test log.test loop.test \ +check_PROGRAMS = array.test ipc.test ipc_sock.test list.test log.test loop.test \ map.test rb.test util.test tlist.test \ crash_test_dummy file_change_bytes -dist_check_SCRIPTS = start.test resources.test blackbox-segfault.sh ipc_sock.test -#lib_LTLIBRARIES = libstat_wrapper.la +dist_check_SCRIPTS = sock_ipc_wrapper.test blackbox-segfault.sh check_LTLIBRARIES = if HAVE_SLOW_TESTS @@ -143,9 +123,6 @@ testsuitedir = $(TESTDIR) testsuite_PROGRAMS = $(check_PROGRAMS) testsuite_SCRIPTS = $(dist_check_SCRIPTS) test.conf -lib_LTLIBRARIES = libstat_wrapper.la -else -noinst_LTLIBRARIES = libstat_wrapper.la endif file_change_bytes_SOURCES = file_change_bytes.c @@ -174,21 +151,39 @@ tlist_test_CFLAGS = @CHECK_CFLAGS@ tlist_test_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ -ipc_test_SOURCES = check_ipc.c -ipc_test_CFLAGS = @CHECK_CFLAGS@ -ipc_test_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ if HAVE_FAILURE_INJECTION -ipc_test_LDADD += _failure_injection.la +check_LTLIBRARIES += _failure_injection.la +_failure_injection_la_SOURCES = _failure_injection.c _failure_injection.h +_failure_injection_la_LDFLAGS = -module +_failure_injection_la_LIBADD = $(dlopen_LIBS) +endif + +check_LTLIBRARIES += _libstat_wrapper.la +_libstat_wrapper_la_SOURCES = _libstat_wrapper.c +_libstat_wrapper_la_LDFLAGS = -module +_libstat_wrapper_la_LIBADD = $(dlopen_LIBS) +ipc_test_SOURCES = check_ipc.c +ipc_test_CFLAGS = @CHECK_CFLAGS@ -DIPC_TEST_NAME_FILE="\"ipc-test-name\"" +ipc_test_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ if HAVE_GLIB ipc_test_CFLAGS += $(GLIB_CFLAGS) ipc_test_LDADD += $(GLIB_LIBS) endif +if HAVE_FAILURE_INJECTION +ipc_test_LDADD += _failure_injection.la +endif -check_LTLIBRARIES += _failure_injection.la -_failure_injection_la_SOURCES = _failure_injection.c _failure_injection.h -_failure_injection_la_LDFLAGS = -module -_failure_injection_la_LIBADD = $(dlopen_LIBS) +ipc_sock_test_SOURCES = check_ipc.c +ipc_sock_test_CFLAGS = @CHECK_CFLAGS@ -DIPC_TEST_NAME_FILE="\"ipc-test-name-sock\"" +ipc_sock_test_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ +if HAVE_GLIB +ipc_sock_test_CFLAGS += $(GLIB_CFLAGS) +ipc_sock_test_LDADD += $(GLIB_LIBS) +endif +ipc_sock_test_LDADD += _libstat_wrapper.la +if HAVE_FAILURE_INJECTION +ipc_sock_test_LDADD += _failure_injection.la endif check_LTLIBRARIES += _syslog_override.la @@ -208,8 +203,43 @@ list_test_CFLAGS = @CHECK_CFLAGS@ list_test_LDADD = $(top_builddir)/lib/libqb.la @CHECK_LIBS@ + +# +# This lot allows the tests to run in parallel +# but with defined dependancies +# +ipc.log: start.test + +sock_ipc_wrapper.log: start.test + +array.log: start.test + +list.log: start.test + +log.log: start.test + +loop.log: start.test + +map.log: start.test + +rb.log: start.test + +tlist.log: start.test + +util.log: start.test + +resources.log: ipc.log sock_ipc_wrapper.log rb.log log.log + endif clean-local: rm -f *.log rm -f *.fdata + rm -f ipc-test-name + rm -f ipc-test-name-sock + rm -f crash_test_dummy.core + + +distclean-local: + rm -rf auto_*.c + rm -rf .deps diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/tests/_libstat_wrapper.c new/libqb-2.0.7+20230607.06c8641/tests/_libstat_wrapper.c --- old/libqb-2.0.6+20220323.758044b/tests/_libstat_wrapper.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/tests/_libstat_wrapper.c 2023-06-07 08:50:17.000000000 +0200 @@ -0,0 +1,55 @@ +/* + * Simulate FORCESOCKETSFILE existing for the IPC tests + */ +#define _GNU_SOURCE +#include <stdio.h> +#include <dlfcn.h> +#include <string.h> +#include <sys/stat.h> +#include "../include/config.h" + +// __xstat for earlier libc +int __xstat(int __ver, const char *__filename, struct stat *__stat_buf) +{ +#if defined(QB_LINUX) || defined(QB_CYGWIN) + static int opened = 0; + static int (*real_xstat)(int __ver, const char *__filename, void *__stat_buf); + + if (!opened) { + real_xstat = dlsym(RTLD_NEXT, "__xstat"); + opened = 1; + } + + if (strcmp(__filename, FORCESOCKETSFILE) == 0) { + fprintf(stderr, "__xstat called for %s\n", __filename); + return 0; /* it exists! */ + } + + return real_xstat(__ver, __filename, __stat_buf); +#else + return -1; /* Error in the unlikely event we get called on *BSD* */ +#endif +} + +// stat for F35 and later +int stat(const char *__filename, struct stat *__stat_buf) +{ +#if defined(QB_LINUX) || defined(QB_CYGWIN) + static int opened = 0; + static int (*real_stat)(const char *__filename, void *__stat_buf); + + if (!opened) { + real_stat = dlsym(RTLD_NEXT, "stat"); + opened = 1; + } + + if (strcmp(__filename, FORCESOCKETSFILE) == 0) { + fprintf(stderr, "stat called for %s\n", __filename); + return 0; /* it exists! */ + } + + return real_stat(__filename, __stat_buf); +#else + return -1; /* Error in the unlikely event we get called on *BSD* */ +#endif +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/tests/check_ipc.c new/libqb-2.0.7+20230607.06c8641/tests/check_ipc.c --- old/libqb-2.0.6+20220323.758044b/tests/check_ipc.c 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/tests/check_ipc.c 2023-06-07 08:50:17.000000000 +0200 @@ -221,9 +221,9 @@ char process_name[256]; /* The process-unique part of the IPC name has already been decided - * and stored in the file ipc-test-name. + * and stored in the file IPC_TEST_NAME_FILE */ - f = fopen("ipc-test-name", "r"); + f = fopen(IPC_TEST_NAME_FILE, "r"); if (f) { fgets(process_name, sizeof(process_name), f); fclose(f); @@ -710,7 +710,7 @@ } - ck_assert_int_eq(max, qb_ipcs_connection_get_buffer_size(c)); + ck_assert_int_le(max, qb_ipcs_connection_get_buffer_size(c)); } @@ -1598,15 +1598,18 @@ } multiple_connections = QB_FALSE; - request_server_exit(); - verify_graceful_stop(pid); - qb_ipcc_disconnect(conn); - + /* Re-enable logging here so we get the "Free'ing" message which allows + for resources.test to clear up after us if needed */ qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_CLEAR_ALL, QB_LOG_FILTER_FILE, "*", LOG_TRACE); qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "*", LOG_TRACE); qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE); + + request_server_exit(); + qb_ipcc_disconnect(conn); + verify_graceful_stop(pid); + } static void @@ -1700,7 +1703,7 @@ ck_assert(conn != NULL); real_buf_size = qb_ipcc_get_buffer_size(conn); - ck_assert_int_eq(real_buf_size, max_size); + ck_assert_int_ge(real_buf_size, max_size); qb_log(LOG_DEBUG, "Testing %d iterations of EVENT msg passing.", num_stress_events); @@ -2113,7 +2116,7 @@ } END_TEST -START_TEST(test_ipc_dispatch_shm_native_prio_dlock) +START_TEST(test_ipc_disp_shm_native_prio_dlock) { pid_t server_pid, alphaclient_pid; struct dispatch_data data; @@ -2152,7 +2155,7 @@ END_TEST #if HAVE_GLIB -START_TEST(test_ipc_dispatch_shm_glib_prio_dlock) +START_TEST(test_ipc_disp_shm_glib_prio_dlock) { pid_t server_pid, alphaclient_pid; struct dispatch_data data; @@ -2369,9 +2372,9 @@ add_tcase(s, tc, test_ipc_service_ref_count_shm, 9); add_tcase(s, tc, test_ipc_server_perms, 7); add_tcase(s, tc, test_ipc_stress_connections_shm, 3600 /* ? */); - add_tcase(s, tc, test_ipc_dispatch_shm_native_prio_dlock, 15); + add_tcase(s, tc, test_ipc_disp_shm_native_prio_dlock, 15); #if HAVE_GLIB - add_tcase(s, tc, test_ipc_dispatch_shm_glib_prio_dlock, 15); + add_tcase(s, tc, test_ipc_disp_shm_glib_prio_dlock, 15); #endif #ifdef HAVE_FAILURE_INJECTION add_tcase(s, tc, test_ipcc_truncate_when_unlink_fails_shm, 8); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/tests/check_loop.c new/libqb-2.0.7+20230607.06c8641/tests/check_loop.c --- old/libqb-2.0.6+20220323.758044b/tests/check_loop.c 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/tests/check_loop.c 2023-06-07 08:50:17.000000000 +0200 @@ -361,7 +361,7 @@ ck_assert(abs_time > 0ULL); ck_assert(rel_time > 0ULL); ck_assert(abs_time > rel_time); - ck_assert(rel_time <= 60*QB_TIME_NS_IN_MSEC); + ck_assert(rel_time <= 500*QB_TIME_NS_IN_MSEC); } @@ -425,10 +425,10 @@ res = qb_loop_timer_add(l, QB_LOOP_LOW, 7*QB_TIME_NS_IN_MSEC, l, reset_one_shot_tmo, &reset_th); ck_assert_int_eq(res, 0); - res = qb_loop_timer_add(l, QB_LOOP_HIGH, 20*QB_TIME_NS_IN_MSEC, l, check_time_left, &test_th2); + res = qb_loop_timer_add(l, QB_LOOP_LOW, 500*QB_TIME_NS_IN_MSEC, l, job_stop, &test_th); ck_assert_int_eq(res, 0); - res = qb_loop_timer_add(l, QB_LOOP_LOW, 60*QB_TIME_NS_IN_MSEC, l, job_stop, &test_th); + res = qb_loop_timer_add(l, QB_LOOP_HIGH, 5*QB_TIME_NS_IN_MSEC, l, check_time_left, &test_th2); ck_assert_int_eq(res, 0); qb_loop_run(l); @@ -471,10 +471,10 @@ res = qb_loop_timer_add(l, QB_LOOP_LOW, 7*QB_TIME_NS_IN_MSEC, l, reset_one_shot_tmo, &reset_th); ck_assert_int_eq(res, 0); - res = qb_loop_timer_add(l, QB_LOOP_HIGH, 20*QB_TIME_NS_IN_MSEC, l, check_time_left, &test_th2); + res = qb_loop_timer_add(l, QB_LOOP_LOW, 500*QB_TIME_NS_IN_MSEC, l, job_stop, &test_th); ck_assert_int_eq(res, 0); - res = qb_loop_timer_add(l, QB_LOOP_LOW, 60*QB_TIME_NS_IN_MSEC, l, job_stop, &test_th); + res = qb_loop_timer_add(l, QB_LOOP_HIGH, 5*QB_TIME_NS_IN_MSEC, l, check_time_left, &test_th2); ck_assert_int_eq(res, 0); qb_loop_run(l); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/tests/ipc_sock.test new/libqb-2.0.7+20230607.06c8641/tests/ipc_sock.test --- old/libqb-2.0.6+20220323.758044b/tests/ipc_sock.test 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/tests/ipc_sock.test 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -#!/bin/sh -# -# Run the IPC tests under the stat wrapper, -# this simulates /etc/libqb/use-filesystem-sockets existing -# so we can test both options without breaking other things -# that might be running on this system. -# -# This creates sockets in /var/run so needs to be root -# -if [ "$(uname -s)" = "Linux" -a "$UID" = "0" ] -then - if [ -f "$(pwd)/.libs/libstat_wrapper.so" ] - then - export "LD_PRELOAD=$(pwd)/.libs/libstat_wrapper.so" - else - export "LD_PRELOAD=$(pwd)/libstat_wrapper.so" - fi - ./ipc.test -else - exit 0 -fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/tests/libstat_wrapper.c new/libqb-2.0.7+20230607.06c8641/tests/libstat_wrapper.c --- old/libqb-2.0.6+20220323.758044b/tests/libstat_wrapper.c 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/tests/libstat_wrapper.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,58 +0,0 @@ -/* - * Simulate FORCESOCKETSFILE existing for the IPC tests - */ -#define _GNU_SOURCE -#include <stdio.h> -#include <dlfcn.h> -#include <string.h> -#include <sys/stat.h> -#include "../include/config.h" -#if defined(QB_LINUX) || defined(QB_CYGWIN) -#include <gnu/lib-names.h> -#endif - -// __xstat for earlier libc -int __xstat(int __ver, const char *__filename, struct stat *__stat_buf) -{ -#if defined(QB_LINUX) || defined(QB_CYGWIN) - static int opened = 0; - static int (*real_xstat)(int __ver, const char *__filename, void *__stat_buf); - - if (!opened) { - real_xstat = dlsym(RTLD_NEXT, "__xstat"); - opened = 1; - } - - if (strcmp(__filename, FORCESOCKETSFILE) == 0) { - fprintf(stderr, "__xstat called for %s\n", __filename); - return 0; /* it exists! */ - } - - return real_xstat(__ver, __filename, __stat_buf); -#else - return -1; /* Error in the unlikely event we get called on *BSD* */ -#endif -} - -// stat for F35 and later -int stat(const char *__filename, struct stat *__stat_buf) -{ -#if defined(QB_LINUX) || defined(QB_CYGWIN) - static int opened = 0; - static int (*real_stat)(const char *__filename, void *__stat_buf); - - if (!opened) { - real_stat = dlsym(RTLD_NEXT, "stat"); - opened = 1; - } - - if (strcmp(__filename, FORCESOCKETSFILE) == 0) { - fprintf(stderr, "stat called for %s\n", __filename); - return 0; /* it exists! */ - } - - return real_stat(__filename, __stat_buf); -#else - return -1; /* Error in the unlikely event we get called on *BSD* */ -#endif -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/tests/resources.test new/libqb-2.0.7+20230607.06c8641/tests/resources.test --- old/libqb-2.0.6+20220323.758044b/tests/resources.test 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/tests/resources.test 2023-06-07 08:50:17.000000000 +0200 @@ -4,13 +4,6 @@ EXPECTED_DLOCK=6 EXPECTED_LEFTOVER=2 -# Linux also runs filesystem socket tests -if [ "$(uname -s)" = "Linux" -a "$UID" = "0" ] -then - EXPECTED_DLOCK=12 - EXPECTED_LEFTOVER=4 -fi - tidy_qb_dirs() { for dd in "$@"; do @@ -19,45 +12,73 @@ done } - -IPC_NAME=$(cat ipc-test-name 2>/dev/null) -for d in /dev/shm /var/run $SOCKETDIR; do +tidy_dlock_sockets() +{ + IPC_NAME=$1 + for d in /dev/shm /var/run $SOCKETDIR; do # Tidy up the deadlock checker sockets first dlocks=$(find $d -name "qb-*-test_*dlock*${IPC_NAME}*" -size +0c 2>/dev/null) if [ "$(echo $dlocks|wc -w)" -eq $(($SOCKS_PER_PROCESS * $EXPECTED_DLOCK)) ]; then - tidy_qb_dirs $dlocks - rm $dlocks + tidy_qb_dirs $dlocks + rm $dlocks elif [ -n "${dlocks}" ]; then - echo - echo "Error: dlock shared memory segments not closed/unlinked" - echo - RETURN=1 + echo + echo "Error: dlock shared memory segments not closed/unlinked" + echo + RETURN=1 fi # Now look for other expected leftovers leftovers=$(find $d -name "qb-*-test_*${IPC_NAME}*" -size +0c 2>/dev/null | wc -l) if [ "${leftovers}" -gt 0 ]; then - echo - echo "Error: shared memory segments not closed/unlinked" - echo - RETURN=1 + echo + echo "Error: shared memory segments not closed/unlinked" + echo + RETURN=1 fi leftovers="$(find $d -name "qb-*-test_*${IPC_NAME}*" -size 0c 2>/dev/null)" - if [ "$(printf '%s\n' "${leftovers}" | wc -l)" -eq $(($SOCKS_PER_PROCESS * $EXPECTED_LEFTOVER)) ]; then - echo - echo "There were some empty leftovers (expected), removing them" - echo "${leftovers}" - echo - tidy_qb_dirs $leftovers + expected=$(($SOCKS_PER_PROCESS * $EXPECTED_LEFTOVER)) + if [ "$(printf '%s\n' "${leftovers}" | wc -l)" -eq "$expected" ]; then + echo + echo "There were some empty leftovers (expected), removing them" + echo "${leftovers}" + echo + tidy_qb_dirs $leftovers elif [ -n "${leftovers}" ]; then - echo - echo "Error: unexpected number of empty leftovers" - echo "${leftovers}" - echo - RETURN=1 + echo + echo "Error: unexpected number of empty leftovers. expected ${expected}" + echo "${leftovers}" + echo + RETURN=1 fi + done + return $RETURN +} + + +IPC_NAME=$(cat ipc-test-name 2>/dev/null) +tidy_dlock_sockets $IPC_NAME +RETURN=$? + +# Linux also runs filesystem socket tests +if [ "$(uname -s)" = "Linux" ] && [ "`id -u`" = "0" ] +then + IPC_NAME=$(cat ipc-test-name-sock 2>/dev/null) + tidy_dlock_sockets $IPC_NAME + if [ $? -ne 0 ] + then + RETURN=$? + fi +fi + +# Clean up empty /dev/shm directories left over by some tests +DIRS=$(grep "Free'ing ringbuffer" ipc.log sock_ipc_wrapper.log| cut -f4 -d ' '|cut -f-4 -d'/'|sort|uniq) +for i in $DIRS +do + rmdir $i 2>/dev/null done + ps aux | grep -v grep | grep -E 'lt-.*\.test' if [ $? -eq 0 ]; then echo "test program frozen" @@ -65,6 +86,6 @@ fi # Keep it tidy - distcheck checks we have not left a mess -rm -f ipc-test-name +rm -f ipc-test-name* rm -f crash_test_dummy.core exit $RETURN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/tests/sock_ipc_wrapper.test new/libqb-2.0.7+20230607.06c8641/tests/sock_ipc_wrapper.test --- old/libqb-2.0.6+20220323.758044b/tests/sock_ipc_wrapper.test 1970-01-01 01:00:00.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/tests/sock_ipc_wrapper.test 2023-06-07 08:50:17.000000000 +0200 @@ -0,0 +1,7 @@ +#/bin/sh -e +# filesystem socket IPC test +if [ "$(uname -s)" = "Linux" ] && [ "`id -u`" = "0" ] +then + ./ipc_sock.test +fi + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libqb-2.0.6+20220323.758044b/tests/start.test new/libqb-2.0.7+20230607.06c8641/tests/start.test --- old/libqb-2.0.6+20220323.758044b/tests/start.test 2022-03-23 10:54:07.000000000 +0100 +++ new/libqb-2.0.7+20230607.06c8641/tests/start.test 2023-06-07 08:50:17.000000000 +0200 @@ -7,7 +7,9 @@ # The test programs all add "qb-test-<name>-" to the front of this. # -NAME="$$-$(date +%s)" +testname=$(echo `uuidgen | sed -e "s#-.*##g"`-`date +%s`) +echo -n $testname > ipc-test-name +testname=$(echo `uuidgen | sed -e "s#-.*##g"`-`date +%s`) +echo -n $testname > ipc-test-name-sock -printf "$NAME" > ipc-test-name mkdir -p $SOCKETDIR