From c61edd4d30ffa6da8c9554096e57c6609d139309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Mon, 9 Oct 2017 23:06:05 +0200 Subject: [PATCH] 1.0.2-9 - Evolution of the previous (rhbz#1478089, rhbz#1487787) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Pokorný --- ...f-tests-dubbed-functional-cover-link.patch | 18 +-- ...n-time-client-side-sanity-check-that.patch | 2 +- ...r-libqb-logging-not-working-with-ld..patch | 105 +++++++++++++----- ...-object-symbol-s-leak-expose-run-tim.patch | 2 +- libqb.spec | 5 +- 5 files changed, 91 insertions(+), 41 deletions(-) diff --git a/03-tests-new-sort-of-tests-dubbed-functional-cover-link.patch b/03-tests-new-sort-of-tests-dubbed-functional-cover-link.patch index 3bcf1d5..577961b 100644 --- a/03-tests-new-sort-of-tests-dubbed-functional-cover-link.patch +++ b/03-tests-new-sort-of-tests-dubbed-functional-cover-link.patch @@ -1,4 +1,4 @@ -From d9ed1dbcd9d58cac8573b75e6db323757f39e27b Mon Sep 17 00:00:00 2001 +From 9e0f0f6d8045a1bd5482a6e704300a324458a96a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Fri, 6 Oct 2017 17:17:26 +0200 Subject: [PATCH 3/6] tests: new sort of tests dubbed "functional", cover @@ -116,8 +116,8 @@ Signed-off-by: Jan Pokorný tests/functional/log_internal/Makefile.am | 23 +++ tests/functional/log_test_client.sh | 22 +++ tests/functional/log_test_interlib_client.sh | 22 +++ - tests/functional/log_test_mock.sh | 283 +++++++++++++++++++++++++++ - 18 files changed, 700 insertions(+), 2 deletions(-) + tests/functional/log_test_mock.sh | 285 +++++++++++++++++++++++++++ + 18 files changed, 704 insertions(+), 2 deletions(-) create mode 100644 tests/functional/GNUmakefile create mode 100644 tests/functional/Makefile.am create mode 100644 tests/functional/log.am @@ -672,10 +672,10 @@ index 0000000..59c5555 +diff -u ../log_interlib_client.err log_interlib_client.err.real diff --git a/tests/functional/log_test_mock.sh b/tests/functional/log_test_mock.sh new file mode 100755 -index 0000000..cc3519d +index 0000000..fb2c02c --- /dev/null +++ b/tests/functional/log_test_mock.sh -@@ -0,0 +1,283 @@ +@@ -0,0 +1,285 @@ +#!/bin/sh +# Copyright 2017 Red Hat, Inc. +# @@ -708,11 +708,13 @@ index 0000000..cc3519d +# - rpm (for parsing archive name embedded in libqb.src.rpm [note that +# rpm2cpio is part of rpm package as well] because the extracted dir +# follows the same naming, which we need to know) -+# - mock + dependencies + fedora-27-${arch} configuration for mock ++# - mock (https://github.com/rpm-software-management/mock/) ++# + dependencies + fedora-27-${arch} configuration for mock +# (or whatever other configuration if some variables below are +# changed appropriately) -+# - koji + dependencies (but binutils packages can be precached when -+# downloaded from https://koji.fedoraproject.org/ manually) ++# - koji (https://pagure.io/koji/) + dependencies (but binutils packages ++# can be precached when downloaded from https://koji.fedoraproject.org/ ++# manually) +# - internet connection (but see the above statement for koji, and +# possibly the full package set within the build'n'test underlying +# container can be precached without further details on "how") diff --git a/04-Med-add-extra-run-time-client-side-sanity-check-that.patch b/04-Med-add-extra-run-time-client-side-sanity-check-that.patch index fe7ad5b..98c0b02 100644 --- a/04-Med-add-extra-run-time-client-side-sanity-check-that.patch +++ b/04-Med-add-extra-run-time-client-side-sanity-check-that.patch @@ -1,4 +1,4 @@ -From 82835b453ac212937592c5a47e992d70b6f2d82b Mon Sep 17 00:00:00 2001 +From b883cc548ff1d487af6cd5bee49c5b386f91df4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Fri, 6 Oct 2017 17:17:26 +0200 Subject: [PATCH 4/6] Med: add extra run-time client-side sanity check that diff --git a/05-High-bare-fix-for-libqb-logging-not-working-with-ld..patch b/05-High-bare-fix-for-libqb-logging-not-working-with-ld..patch index ec6f018..97bdccd 100644 --- a/05-High-bare-fix-for-libqb-logging-not-working-with-ld..patch +++ b/05-High-bare-fix-for-libqb-logging-not-working-with-ld..patch @@ -1,4 +1,4 @@ -From a76c1d7c3466746c96dffd6406017d438bb22018 Mon Sep 17 00:00:00 2001 +From 509beb47f2494e7fe207180266401288da1b6b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Fri, 6 Oct 2017 17:17:26 +0200 Subject: [PATCH 5/6] High: bare fix for libqb logging not working with @@ -7,6 +7,8 @@ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +(or rather [read on]: "bare" fix) + Initially with the help of the internal test suite and the failing log test, it was eventually discovered[1] that these binutils commits going to the recent 2.29 release affected the treatment of _start_SECNAME @@ -38,9 +40,9 @@ https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=487b6440dad57440939fa At least that change doesn't invalidate all the effort being put into the original version of the changeset, only the configure script check had to be refined so as not to miss the "orphan section magic not -working properly out of the box, without a bandaid" obseration (see the -inline comment) -- the workaround arrangement needs to be applied in -that case as well. +working properly out of the box, without a bandaid" observation +(see the inline comment) -- the workaround arrangement needs +to be applied in that case as well. * * * @@ -77,15 +79,25 @@ So further extensions were devised to cover both consumption models: to post-modify libqb.la libtool archive file generated internally by libtool, we sort of abuse "inherited_linker_flags" variable within this file format, as it forms an accumulative value across - the whole transitive dependencies chain, which serves exactly our - purpose of injecting "-Wl,foo.t" switch equivalent for those - libtool-linking by L{D,IB}ADDing libqb.la; it's then enough to - craft a custom libtool archive file declaring that value, and - hook it into such dependency chain through libqb_la_LIBADD, and - with a little bit of further fiddling, it works as desired - (note that double occurrence of "-Wl,foo.t" equivalent achieved - at some point when developing this trick turned to be, surprisingly, - counter-productive) + the whole transitive dependencies chain (if not impaired per the + note below), fitting exactly our purpose of injecting "-Wl,foo.t" + switch equivalent for those libtool-linking by L{D,IB}ADD'ing + libqb.la; it's then enough to craft a custom libtool archive file + declaring that value, and hook it into such dependency chain through + libqb_la_LIBADD, and with a little bit of further fiddling, it works + as desired (note that double occurrence of "-Wl,foo.t" equivalent + present at some stages of sorting this trick turned out to be, + surprisingly, counter-productive); + + NOTE: some forms of libtool distribution (debian + derivatives ones + in particular) undermine natural transitive dependency propagation + with a deliberate cut off (https://bugs.debian.org/702737), so we + need to ensure the "impairment" is not happening by force (corosync + precedent: https://github.com/corosync/corosync/commit/0f1dc5c1) + ^ something like this needs to be applied for any such "private + consumer" (although it hopefully goes without saying this way + of consuming libqb outside of it's own playground is hardly + the Right Thing) if portability is important, nonetheless! Last but not least, libqb itself needs to be linked with the mentioned "-Wl,foo.t" equivalent for its own outgoing log messages to be honoured, @@ -138,7 +150,7 @@ Deficiencies: > /usr/bin/ld: warning: ../lib/qblog_script.ld contains output sections; did you forget -T? - not solvable as long as we use the linker script, and there's hardly any other way not requiring the libqb consumers to adapt - in any way + in any aspect Open questions: * what about binutils 2.99.1 partially mitigating the impact of the @@ -162,31 +174,64 @@ References: Signed-off-by: Jan Pokorný --- - configure.ac | 71 +++++++++++++++++++++++++++++++++++++++--------- - lib/Makefile.am | 67 +++++++++++++++++++++++++++++++++++++++++++++ - lib/log.c | 7 +++++ - lib/qblog_script.la.in | 15 ++++++++++ - lib/qblog_script.ld.in | 17 ++++++++++++ + configure.ac | 90 +++++++++++++++++++++++++++++++++++++++++------- + lib/Makefile.am | 67 +++++++++++++++++++++++++++++++++++ + lib/log.c | 7 ++++ + lib/qblog_script.la.in | 15 ++++++++ + lib/qblog_script.ld.in | 17 +++++++++ lib/qblog_script_noop.ld | 1 + - 7 files changed, 165 insertions(+), 13 deletions(-) + 7 files changed, 184 insertions(+), 13 deletions(-) create mode 100644 lib/qblog_script.la.in create mode 100644 lib/qblog_script.ld.in create mode 100644 lib/qblog_script_noop.ld diff --git a/configure.ac b/configure.ac -index 5601302..5d17443 100644 +index 5601302..6eda2dd 100644 --- a/configure.ac +++ b/configure.ac -@@ -618,31 +618,74 @@ AC_SUBST(HAVE_SLOW_TESTS) +@@ -501,6 +501,12 @@ AC_ARG_ENABLE([debug], + AC_ARG_ENABLE([coverage], + [AS_HELP_STRING([--enable-coverage],[coverage analysis of the codebase])]) + ++AC_ARG_ENABLE([interlib-deps], ++ [AS_HELP_STRING([--disable-interlib-deps], ++ [disable inter-library dependencies (might break builds)])], ++ [enable_interlib_deps="$enableval"], ++ [enable_interlib_deps="yes"]) ++ + AC_ARG_ENABLE([slow-tests], + [AS_HELP_STRING([--enable-slow-tests],[build and run slow tests])]) + +@@ -609,6 +615,19 @@ else + COVERAGE_LDFLAGS="" + fi + ++# --- inter-library dependencies --- ++# because of debian/ubuntu swimming against the stream ++# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702737, ++# override the libtool variable by force because the current ++# arrangement relies on transitive dependency propagation ++AC_MSG_NOTICE([Enabling inter-library dependencies: $enable_interlib_deps]) ++if test "${enable_interlib_deps}" == "yes"; then ++ link_all_deplibs=yes ++else ++ link_all_deplibs=no ++fi ++ ++# --- slow tests --- + if test "x${enable_slow_tests}" = xyes ; then + AC_DEFINE([HAVE_SLOW_TESTS], 1,[have slow tests]) + AC_MSG_NOTICE([Enabling Slow tests]) +@@ -618,31 +637,74 @@ AC_SUBST(HAVE_SLOW_TESTS) # --- callsite sections --- if test "x${GCC}" = xyes; then -+ LDFLAGS_save="${LDFLAGS}" ++ AX_SAVE_FLAGS AC_MSG_CHECKING([whether GCC supports __attribute__((section()) + ld supports orphan sections]) if test "x${ac_cv_link_attribute_section}" = x ; then - AC_TRY_RUN( - AC_LANG_PROGRAM( -+ LDFLAGS="${LDFLAGS_save} -shared -fPIC" ++ LDFLAGS="${LDFLAGS_save} -shared -fPIC" # we are compiling shared lib + AC_LINK_IFELSE( + [AC_LANG_SOURCE( [[#include @@ -206,7 +251,7 @@ index 5601302..5d17443 100644 + [gcc_has_attribute_section=yes; cp "conftest${EXEEXT}" "lib_conftest.so"], [gcc_has_attribute_section=no] ) -+ LDFLAGS="${LDFLAGS_save}" ++ AX_RESTORE_FLAGS else gcc_has_attribute_section=${ac_cv_link_attribute_section} fi @@ -226,7 +271,7 @@ index 5601302..5d17443 100644 + # but the workaround is still provably needed + if test "x${gcc_has_attribute_section}" = xyes; then + AC_MSG_CHECKING([whether linker emits global boundary symbols for orphan sections]) -+ LDFLAGS="${LDFLAGS_save} -L. -l_conftest -Wl,-rpath=$(pwd)" ++ LIBS="${LIBS} -L. -l_conftest -Wl,-rpath=$(pwd)" + AC_TRY_RUN( + AC_LANG_PROGRAM( + [[#include @@ -239,7 +284,7 @@ index 5601302..5d17443 100644 + [gcc_has_attribute_section_visible=yes], + [gcc_has_attribute_section_visible=no] + ) -+ LDFLAGS="${LDFLAGS_save}" ++ AX_RESTORE_FLAGS + AC_MSG_RESULT($gcc_has_attribute_section_visible) + rm -f "lib_conftest.so" + @@ -263,7 +308,7 @@ index 5601302..5d17443 100644 # --- ansi --- if test "x${enable_ansi}" = xyes && \ -@@ -724,9 +767,11 @@ AC_CONFIG_FILES([Makefile +@@ -724,9 +786,11 @@ AC_CONFIG_FILES([Makefile docs/Makefile docs/common.dox docs/html.dox @@ -278,7 +323,7 @@ index 5601302..5d17443 100644 AC_OUTPUT diff --git a/lib/Makefile.am b/lib/Makefile.am -index 0bebeb5..cc7417c 100644 +index 0bebeb5..340cd85 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -19,6 +19,7 @@ @@ -343,7 +388,7 @@ index 0bebeb5..cc7417c 100644 endif +qblog_script.ld: %.ld: %.ld.in -+ $(AM_V_GEN)$(CPP) -xc -I$(top_srcdir)/include -C -P $< \ ++ $(AM_V_GEN)$(CPP) -xc -I$(top_srcdir)/include -D_GNU_SOURCE -C -P $< \ + | sed -n "/$$(sed -n '/^[^#]/{s/[*\/]/\\\0/g;p;q}' $<)/{:r;p;n;br}" \ + > $@ + diff --git a/06-Low-fix-internal-object-symbol-s-leak-expose-run-tim.patch b/06-Low-fix-internal-object-symbol-s-leak-expose-run-tim.patch index 4eb3f2d..501f7f6 100644 --- a/06-Low-fix-internal-object-symbol-s-leak-expose-run-tim.patch +++ b/06-Low-fix-internal-object-symbol-s-leak-expose-run-tim.patch @@ -1,4 +1,4 @@ -From 1854db8ec1e3b246eff303b716495bafd90ded49 Mon Sep 17 00:00:00 2001 +From e6833567cd834cbbd182c48327b7e8ce3a8fc2bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Fri, 6 Oct 2017 17:17:26 +0200 Subject: [PATCH 6/6] Low: fix internal object symbol's leak & expose run-time diff --git a/libqb.spec b/libqb.spec index 71469a5..ef8d76a 100644 --- a/libqb.spec +++ b/libqb.spec @@ -2,7 +2,7 @@ Name: libqb Version: 1.0.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: An IPC library for high performance servers Group: System Environment/Libraries @@ -77,6 +77,9 @@ developing applications that use %{name}. %{_mandir}/man3/qb*3* %changelog +* Mon Oct 09 2017 Jan Pokorný - 1.0.2-9 +- Evolution of the previous (rhbz#1478089, rhbz#1487787) + * Fri Oct 06 2017 Jan Pokorný - 1.0.2-8 - Evolution of the previous (rhbz#1478089, rhbz#1487787) - New test included in check phase (as per upsteam)