Commit Graph

1744 Commits

Author SHA1 Message Date
Christine Caulfield
60887f4cf7
skiplist: Fix previous skiplist fix
The last fix to skiplist never ran the code that patched up the level
list as it updated the current level before runnign the loop.

This now works.

Merges: https://github.com/ClusterLabs/libqb/pull/333
Reviewed-by: Jan Pokorný <jpokorny@redhat.com>
2018-12-12 16:17:59 +01:00
Ferenc Wágner
021333be37 New patch: Reduce stress test lengths to help weak buildds 2018-12-03 20:27:39 +01:00
Ferenc Wágner
1774a2f4ce Update changelog for 1.0.3-2 release 2018-12-02 19:27:53 +01:00
Ferenc Wágner
f36c1fb60e The debug symbol migration is complete 2018-12-02 19:27:36 +01:00
Ferenc Wágner
ae712b7c86 Update Standards-Version to 4.2.1 (no changes required) 2018-12-02 19:27:36 +01:00
Ferenc Wágner
16869023f1 Multiarch support does not require Pre-Depends anymore 2018-12-02 19:27:36 +01:00
Ferenc Wágner
0d1cda6902 autopkgtest: test the installed library, headers and pkg-config file
This gets rid of build-needed and hopefully lets the test pass, even.
2018-12-02 19:27:23 +01:00
Chrissie Caulfield
926e851fbb
log: Remove more dead code from linker callsites (#331)
Thanks for the review
2018-11-12 15:55:33 +00:00
Chrissie Caulfield
7556204b27 Add the option of hi-res (millisecond) timestamps (#329)
* log: Add high-resolution timestamp option for log files

This adds the %T option to the log format for millisecond timestamps. There's a feature test macro QB_FEATURE_LOG_HIRES_TIMESTAMPS so that applications know that they are available.

Because this changes the internal logging API, applications that use custom loggers will also need to change their custom logging destinations to take a struct timespec instead of a time_t. The above feature test macro will help in deciding which is appropriate.
2018-11-09 09:56:44 +00:00
Fabio M. Di Nitto
6f6845496a [build] fix supported compiler warning detection (#330)
move from AC_PREPROC_IFELSE (strongly discouraged) to AC_COMPILE_IFELSE

our detection system was very weak and recent versions of clang did
show that PREPROC_IFELFE (cpp) would enable warning options that
the compiler does not support (clang).

use a full compilation test to detect what works and what doesn't.

Also expand the warning list to include new / renamed clang options
of equivalents already enabled for older versions of clang and gcc.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2018-11-08 08:38:08 +00:00
Chrissie Caulfield
b38614e589
log: Add configure-time option to use systemd journal instead of syslog (#327)
* log: add systemd journal as a logging option

systemd journal can be configured as a logging option
at ./configure time (--enable-systemd-journal).

If libqb is buit with this then the syslog target can be switched
to sending to the journal using
qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_USE_JOURNAL, 1);
2018-10-26 08:52:16 +01:00
Yusuke Iida
7345e3a0bb configure: Fixed the problem that librt was explicitly needed in RHEL 6 (#328) 2018-10-23 10:01:36 +01:00
Chrissie Caulfield
6032d210d1
log: Add option to re-open a log file (#326)
As this patch also brought up some locking issues with re-configuring the logging while threaded logging was enabled, it also includes locking around qb_log_ctl2() and conversion of in_logger to an atomic.
2018-10-16 08:12:06 +01:00
Christine Caulfield
44a9379c89 skiplist: fix use-after-free in the skiplist traversal
(Patch from poki, only committed under my name because github is being
weird)

This used to happen when an iterator contained a reference on the item
to continue with, which got outdated when such item had been removed in
the interim, though it's original memory would still be -- mistakenly --
accessed. Actually such a condition is exercised with an existing
"test_map_iter_safety(ordered=true)" test, though it likely never run
under valgrind's supervision and standard memory checking harness was
too coarse (perhaps because of low memory pressure or other "lucky"
coincidence). Thankfully, the default, paranoid approach towards dynamic
memory handling in OpenBSD (free(3) call makes small chunks "junked",
i.e., filled with 0xdf bytes, see malloc.conf(5)) resulted in the
explicit segmentation fault when tripping over the happens-to-be-freed
pointer in the assumed iteration chain.

We solve the "out-of-sync iterator" issue with a twist, inverting
the responsibility to carry (and more widely, to contribute in the
propagation of) the up-to-date "forward" pointers, as clearly,
iterating over and over through the items would not be very scalable
(and it was not done, which had resulted in the first place).
So now, when any skiplist item is to be removed, its preceding item
gets the "forward" pointers recomputed as before, but then, they are
copied into "forward" pointers for the item to be removed, original
area containing them is disposed, and this preceding item just points
to the area primarily managed by the to-be-removed item (procedure
dubbed "takeover-and-repoint" in the comment). This itself gets
a special mark so that this area won't be dropped when that item gets
disposed, which rather happens with the disposal of the preceding item
that points to the "forward" memory area at hand and is not marked so.
This is believed to be sufficient to address out-of-band (iterator
based) access versus interim future iteration chain mangling, as these
operate de facto on the non-sparse, linear level of the skiplist.

Alternative approaches include:

    turning pointers-to-arrays into pointers-to-pointers-to-arrays to
    allow for explicit setting to NULL after free, and sharing this
    additional indirection -- this straightforward extension was
    attempted first, but shortly after, it became apparent it would
    be a nightmare with the current interprocedural dependencies

    extra tagging of the structures and adding complexities around
    checking the eligibility, like every other manipulation with the
    skiplist

    completely split life-cycle of "node" and "node->forward", i.e.,
    separate reference-counting etc.

Also said test was extended to push the corner case to the limit:
when to-resume-with item in the chain is being figured out, the
predecessors may be consulted (it is in that test), but the very
first predecessor is now removed as well, for good measure, as
it makes for boundary condition ^ 2.

Signed-off-by: Jan Pokorný jpokorny@redhat.com
2018-10-15 10:10:43 +01:00
Chrissie Caulfield
633f2624a7
logging: Remove linker 'magic' and just use statics for logging callsites (#322)
It is my (and several others') opinion that the linker 'magic' used to maintain callsite data in libqb is hugely over complicated and unnecessarily fragile. It's main purpose seems to have been to improve performance but empirical testing shows this to be tiny at best. The overhead of sprintf makes minor optimisations in this code pointless.

With this code removed, libqb allocates callsites using a C static variable at run-time. This sounds bad but in actuality it merely moves the allocation from program load time to the first few milliseconds of program run-time. Applications like corosync and pacemaker spend most of their time in small loops doing the same work over and over again so the overhead doesn't apply and jitter does not occur.

We've tested this with corosync and pacemaker under valgrind and massif and the differences are minimal and even then only show up under artificial stress testing.

For this change I've bumped the soname up to 20 to indicate this is an incompatible change. I'm open to suggestions as to a release number but am currently thinking of 2.0.0
2018-09-27 09:20:06 +01:00
Chrissie Caulfield
d0ec0a6a57
UPDATED: doc (ABI comparison) and various other fixes (#324)
* doc: qbarray.h: fix garbled Doxygen markup

* build: follow-up for and fine-tuning of a rushed 6d62b64 commit
  (It made a service as-was, but being afforded more time, this would
  have accompanied that commit right away, for better understanding,
  brevity and uniformity.)

* build: prune superfluous Makefile declarations within tests directory
  There was a significant redundancy wrt. build flags and EXTRA_DIST
  assignment (the latter become redundant as of f6e4042 at latest)
  spread all over the place (vivat copy&paste).  Also, in one instance,
  CPPFLAGS (used) was confused with CFLAGS (meant).

* maint: check abi: fix two issues with abi-compliance-checker/libstdc++
1. ABICC >= 2 needs to be passed -cxx-incompatible switch because C is
   no longer a default for this tool (used to be vice versa),
   plus current version will stop choking on C vs. C++ (our C code with
   C++ compatibility wrapping being viewed from C++ perspective for the
   purpose of dumping the declared symbols, which somewhat conflicts
   with internal masking of the C++ keywords being used as valid C
   identifiers [yet some instances must not be masked here, see
   https://github.com/lvc/abi-compliance-checker/issues/64) only
  if _also_ something like this is applied:
   https://github.com/lvc/abi-compliance-checker/pull/70
2. since 20246f5, libqb.so no longer poses a symlink to the actual
   version-qualified shared library, but rather a standalone linker
   script, which confuses ABICC, so blacklist that file for the scanning
   purposes explicitly, together with referring to the library through
   it's basic version qualification (which alone, sadly, is not
   sufficient as ABICC proceeds to scan whole containing directory
   despite particular file is specified)

* maint: check abi: switch to abi-dumper for creating "ABI dumps"
Beside avoiding issues with abi-compliance-checker in the role of ABI
dumps producer (see the preceding commit), it also seems to generate
more accurate picture (maybe because it expressly requires compiling
with debugging information requested).

* Low: qblist.h: fix incompatibility with C++ & check it regularly

* tests: check_list.c: start zeroing in on the gaps in tests' coverage

* tests: print_ver: make preprocessor emit "note" rather than warning

IIRC, Chrissie asked about this around inclusion of the test at
hand, and it seemed there was no way but to emit a warning to get
something output at all.  Now it turns wrong, and moreover, we
make the code not fixed on GCC specific pragmas, with a bit of
luck, "#pragma message" approach is adopted more widely by compilers.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>

* Replace ck_assert_uint_eq() with ck_assert_int_eq()
it's not available in check 0.9

* Proper check for C++ compiler (from Fabio)
* add (c) to copyright dates
2018-09-25 08:38:37 +01:00
Jan Pokorný
d6875f29d6
build: allow for being consumed in a (non-endorsed) form of snapshots
This is meant as a lean, customized policy driven alternative
to the original proposal by Jan Friesse <jfriesse@redhat.com> that
balances the inherent trade-off in the opposite direction, so that the
configure.ac script is practically untouched and more weight and policy
is hardcoded in git-version-gen.  Problem with that approach stems from
(avoidable) effective fork of the respective gnulib's module and imposed
maintenance burden.

Speaking for libqb in particular, we should nonetheless make it
absolutely clear such in-development snapshots are nothing more,
nothing binding (not to think of viral injection of these bits
into circle of dependent packages upon their rebuilds), since the
changes accumulated since the last official release should only be
assumed firmly committed at the point the new release is cut (may
happen 99% of time with snapshots but no accountability from our
side for the complementary inter-release twists...), which is exactly
when many possibly unanticipated variables like correct SONAME
versions get to reflect what's appropriate.
Also, OpenPGP signature constitutes something more eligible for
one's trust than (provably) bit/content unstable archives without
the possibility of an independent authenticity/integrity verification.

  Therefore, the only thinkable and upstream-endorsed use cases
  for such snapshots are development-only purposes (CI et al.)!

V2 of the patch:
Thanks to feedback from Jan Friesse, a glitch in "make rpm" et al.
not working with the snapshots was pointed out.

V3:
Only normalize configure.ac back when known to be previously affected
with "git archive" substitution logic, and do not use an exclamation
mark as short commit - decoration separator since that could be
ambiguous (it is a valid branch name character), stick with double
question marks instead (not allowed, doubled for good measure).

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2018-09-13 10:54:16 +02:00
Jan Pokorný
3af6104e3e
build: configure: fix non-portable '\s' and '//{q}' in sed expression
Turned out that the current way of checking of symbol visibility
(introduced with the main linker compatibiity fixing commit 20246f54)
doesn't work on FreeBSD as caught thanks for Kronosnet's CI[0]:

> checking whether linker emits global boundary symbols for orphan
> sections... sed: 1: "/__start___verbose/{s/^ ...": extra characters
> at the end of q command

[0] https://ci.kronosnet.org/view/libqb/job/libqb-build-all-nonvoting/libqb-build-all-nonvoting=freebsd-devel-x86-64/lastBuild/consoleFull

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2018-09-04 18:00:21 +02:00
Daniel Black
09614dc0e5
build: dpkg-architecture on trusty (cf. Travis CI) uses -q{NAME}
Signed-off-by: Daniel Black <daniel@linux.ibm.com>
Reviewed-by: Jan Pokorný <jpokorny@redhat.com>
2018-08-28 13:59:00 +02:00
Daniel Black
a4a7d6ed01
build: split hack for splint to work on non-x86 architectures
Uses dpkg-architecture, if present, to return
DEB_HOST_GNU_TYPE, and use this appended to /usr/include
for form the path.

Signed-off-by: Daniel Black <daniel@linux.ibm.com>
Reviewed-by: Jan Pokorný <jpokorny@redhat.com>
2018-08-28 10:37:31 +02:00
Daniel Black
4b7ffd0fa5
CI: travis: show logs of test failures
Signed-off-by: Daniel Black <daniel@linux.ibm.com>
Reviewed-by: Jan Pokorný <jpokorny@redhat.com>
2018-08-28 10:36:32 +02:00
Daniel Black
621b743207
tests: blackbox-segfault test - remove residual core files
Signed-off-by: Daniel Black <daniel@linux.ibm.com>
Reviewed-by: Jan Pokorný <jpokorny@redhat.com>
2018-08-28 10:35:29 +02:00
Valentin Vidic
7b5831e388 Fix failing debian/tests/ipc
Test was failing due to missing shared library.
2018-06-09 12:51:59 +02:00
Chrissie Caulfield
c235284b5f
log: Use RTLD_NOOPEN when checking symbols (#310)
on FreeBSD 11 call dlopen on a shared library causes the constructors
to run again. As we're just getting symbols we don't need this to
happen.

Actually we don't WANT it to happen because it can cause qb_log_init to
be called twice (recursively) and the dlnames list gets corrupted. This
causess corosync (at leasT0 to crash at startup.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2018-05-14 08:24:10 +01:00
Fabio M. Di Nitto
eeb5e45c55 tests: use RUNPATH instead of RPATH consistently (#309)
some vendors default to RPATH, others to RUNPATH. The former does not allow override
with LD_LIBRARY_PATH when running binaries such as test suite and it was causing
problems on platforms where RPATH is default, by running the test suite against
the wrong library (out-of-tree vs in-tree).

This change has no effect on libqb itself, but only on the binaries.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2018-05-03 16:03:54 +01:00
Chrissie Caulfield
0ec02f9ac5
Allow customisable log line length (#292)
* log: Allow flexible size of logging buffer & ellipsis if it overflows.

Allow the logging line length to be changed. Any reasonable length is allowable, the default is 512 as before. Anything more than 512 incurs several mallocs.

Also add an option to set the last 3 characters as '...' if the line length overflows.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2018-05-03 09:25:06 +01:00
Chrissie Caulfield
75ab31bdd0
ipc_shm: Don't truncate SHM files of an active server (#307)
* ipc_shm: Don't truncate SHM files of an active server

I've put in an extra check so that clients don't truncate the
SHM file if the server still exists. Sadly on FreeBSD we can't
get the server PID for the client (unless someone has a patch handy!)
so we still do the truncate when disconnected. As a backstop (and also
to cover the BSD issue) I've added a SIGBUS trap to the server shutdown
so that it doesn't cause a server crash.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed by: Jan Friesse <jfriesse@redhat.com>
2018-04-20 09:48:04 +01:00
Chrissie Caulfield
3730644c35
test: Fix 'make distcheck' (#303)
Miscellaneous fixes and cleanups to get 'make distcheck' to work on most
platforms.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
2018-03-27 13:11:20 +01:00
wferi
153956c75b Fix comment typo (#296)
* Fix misleading comment on preprocessor conditional
* Fix spelling: plaform -> platform

Signed-off-by: Ferenc Wágner <wferi@debian.org>
2018-03-20 13:12:06 +00:00
Ferenc Wágner
865a1eac7f Update changelog for 1.0.3-1 release 2018-03-14 12:43:55 +01:00
Ferenc Wágner
42afbde475 New patch Fix-spelling-plaform-platform.patch
Fix spelling: plaform -> platform
2018-03-14 12:41:19 +01:00
Ferenc Wágner
fe6e5557c2 Lintian does not emit embedded-javascript-library for Doxygen anymore 2018-03-14 12:41:19 +01:00
Ferenc Wágner
343b790571 qb-blackbox makes libqb-dev not co-installable 2018-03-14 12:41:19 +01:00
Ferenc Wágner
0d73506e3e Modernize watch file, add signature checking 2018-03-14 12:41:19 +01:00
Ferenc Wágner
c6d7de2a25 Use secure URI in the Homepage field 2018-03-14 12:41:19 +01:00
Ferenc Wágner
5ad582f58c Ship example code in the doc package 2018-03-14 12:41:19 +01:00
Ferenc Wágner
209356913a Whitespace cleanup in debian/changelog 2018-03-14 10:20:22 +01:00
Ferenc Wágner
6e9aa99fd2 Migrate to salsa.debian.org/ha-team 2018-03-14 10:20:20 +01:00
Ferenc Wágner
75fc9d2aa0 Stop repeating the common description 2018-03-14 10:19:19 +01:00
Ferenc Wágner
ae9b078730 Switch gbp dch to verbose changelog entries 2018-03-14 10:17:40 +01:00
Ferenc Wágner
419537a1a1 New patch hurd-the-socket-tests-are-expected-to-fail.patch
hurd: the socket tests are expected to fail

Closes: #803777
2018-03-14 10:17:40 +01:00
Ferenc Wágner
b7d5deaf28 New patch tests-always-run-the-SHM-suite-just-expect-failures.patch
tests: always run the SHM suite, just expect failures
2018-03-14 10:17:40 +01:00
Ferenc Wágner
930dba85cc Combat test failures with a world-writeable socket directory
On Linux systems libqb uses abstract sockets by default, which lack
access control.  However, they aren't available on other platforms.
The other option is using file system sockets, by default under
/var/run.  This directory is only writable by root, though, which
makes it inapproriate for unprivileged applications.  So use /tmp
instead.

See also: https://github.com/ClusterLabs/libqb/issues/294
2018-03-14 10:17:40 +01:00
Ferenc Wágner
1fc3d87903 Switch to Debhelper compat level 11 2018-03-14 10:17:40 +01:00
Chrissie Caulfield
67e739e83f
tests: Improve test isolation (#298)
* tests: Improve test isolation

Make all the IPC tests run with a common date/pid stamp name, so that
the final resource.test only fails if it finds one of OUR files left
lying around and not those from another test.

Falls back to old IPC naming style if we can't create the file.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by:  Jan Friesse <jfriesse@redhat.com>
2018-03-08 15:30:02 +00:00
Ferenc Wágner
737a79d424 Update Standards-Version to 4.1.3 (no changes required) 2018-02-21 10:27:33 +01:00
Ferenc Wágner
dc0438b727 New patch hurd-definition-of-PATH_MAX-must-be-included-separately.patch
hurd: definition of PATH_MAX must be included separately
2018-02-21 10:27:33 +01:00
Ferenc Wágner
13e68c7e21 Update symbols file
Remove some internal symbols (see c011b12) and add a new one.
2018-02-21 10:24:52 +01:00
Ferenc Wágner
2fa97040b6 Remove upstreamed/obsoleted patches, refresh the Hurd support patch 2018-01-05 21:27:12 +01:00
Ferenc Wágner
c56638158a Merge tag 'upstream/1.0.3' into debian/master
Upstream version 1.0.3
2018-01-04 22:22:35 +01:00