Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package telemetrics-client for openSUSE:Factory checked in at 2021-01-19 16:01:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/telemetrics-client (Old) and /work/SRC/openSUSE:Factory/.telemetrics-client.new.28504 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "telemetrics-client" Tue Jan 19 16:01:42 2021 rev:8 rq:861706 version:2.3.5+git20200224.c3b8d81 Changes: -------- --- /work/SRC/openSUSE:Factory/telemetrics-client/telemetrics-client.changes 2019-12-27 13:49:04.644475814 +0100 +++ /work/SRC/openSUSE:Factory/.telemetrics-client.new.28504/telemetrics-client.changes 2021-01-19 16:02:01.595364749 +0100 @@ -1,0 +2,20 @@ +Fri Jan 08 13:29:58 UTC 2021 - [email protected] + +- Update to version 2.3.5+git20200224.c3b8d81: + * configure.ac: bump version + * fix first record missing from journal + * Don't try to start the klogscanner service inside a container + * configure.ac: bump version + * crash_probe.c: process_corefile: reset frame counter + * replace travis badge for github workflows + * random shift to hprobe timer + * pr comments and actions update + * update CI configuration + * fix potential leaks + * fixing memory leaks in tests + * valgrind check for tests + * Trigger verification on PR opening + * configure.ac: bump version + * telemctl.c: fix buffer overflow + +------------------------------------------------------------------- Old: ---- telemetrics-client-2.3.2+git20191217.8ca2993.tar.xz New: ---- telemetrics-client-2.3.5+git20200224.c3b8d81.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ telemetrics-client.spec ++++++ --- /var/tmp/diff_new_pack.HEMiIt/_old 2021-01-19 16:02:02.599366267 +0100 +++ /var/tmp/diff_new_pack.HEMiIt/_new 2021-01-19 16:02:02.603366273 +0100 @@ -1,7 +1,7 @@ # # spec file for package telemetrics-client # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: telemetrics-client -Version: 2.3.2+git20191217.8ca2993 +Version: 2.3.5+git20200224.c3b8d81 Release: 0 Summary: Telemetrics solution License: LGPL-2.1-or-later ++++++ _service ++++++ --- /var/tmp/diff_new_pack.HEMiIt/_old 2021-01-19 16:02:02.655366352 +0100 +++ /var/tmp/diff_new_pack.HEMiIt/_new 2021-01-19 16:02:02.655366352 +0100 @@ -1,11 +1,10 @@ <services> <service name="tar_scm" mode="disabled"> - <param name="version">2.3.2</param> - <param name="versionformat">2.3.2+git%cd.%h</param> + <param name="version">2.3.5</param> + <param name="versionformat">2.3.5+git%cd.%h</param> <param name="url">git://github.com/clearlinux/telemetrics-client.git</param> <param name="scm">git</param> <param name="changesgenerate">enable</param> - <param name="changesauthor">[email protected]</param> </service> <service name="recompress" mode="disabled"> <param name="compression">xz</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.HEMiIt/_old 2021-01-19 16:02:02.679366388 +0100 +++ /var/tmp/diff_new_pack.HEMiIt/_new 2021-01-19 16:02:02.679366388 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/clearlinux/telemetrics-client.git</param> - <param name="changesrevision">8ca299314c04aea61b5185d775965d834e4e87e5</param> + <param name="changesrevision">c3b8d81b6df5bd6d77491ed2b5dc00e405dbf5dd</param> </service> </servicedata> \ No newline at end of file ++++++ telemetrics-client-2.3.2+git20191217.8ca2993.tar.xz -> telemetrics-client-2.3.5+git20200224.c3b8d81.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/.github/workflows/ccpp.yml new/telemetrics-client-2.3.5+git20200224.c3b8d81/.github/workflows/ccpp.yml --- old/telemetrics-client-2.3.2+git20191217.8ca2993/.github/workflows/ccpp.yml 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/.github/workflows/ccpp.yml 2020-02-24 22:37:06.000000000 +0100 @@ -1,6 +1,6 @@ name: C/C++ CI -on: [push] +on: [push, pull_request] jobs: build: @@ -25,5 +25,7 @@ run: make -j8 - name: check run: make check + - name: valgrind memcheck + run: make check-valgrind - name: make distcheck run: make distcheck diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/.travis.yml new/telemetrics-client-2.3.5+git20200224.c3b8d81/.travis.yml --- old/telemetrics-client-2.3.2+git20191217.8ca2993/.travis.yml 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,35 +0,0 @@ -dist: trusty - -compiler: - - gcc - -os: - - linux - -before_script: - ./autogen.sh - -language: c - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - libcurl4-gnutls-dev - - valgrind - - autoconf - - automake - - check - - libelf-dev - - libdw-dev - -install: - - wget https://github.com/libcheck/check/releases/download/0.12.0/check-0.12.0.tar.gz - - tar -xvf check-0.12.0.tar.gz - - pushd check-0.12.0 && ./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu && make -j48 && sudo make install && popd - -script: - - ./configure && make && make check - -after_failure: cat test-suite.log diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/README.md new/telemetrics-client-2.3.5+git20200224.c3b8d81/README.md --- old/telemetrics-client-2.3.2+git20191217.8ca2993/README.md 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/README.md 2020-02-24 22:37:06.000000000 +0100 @@ -1,4 +1,4 @@ -[](https://travis-ci.org/clearlinux/telemetrics-client) + Telemetrics-client ================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/build-aux/m4/ax_valgrind_check.m4 new/telemetrics-client-2.3.5+git20200224.c3b8d81/build-aux/m4/ax_valgrind_check.m4 --- old/telemetrics-client-2.3.2+git20191217.8ca2993/build-aux/m4/ax_valgrind_check.m4 1970-01-01 01:00:00.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/build-aux/m4/ax_valgrind_check.m4 2020-02-24 22:37:06.000000000 +0100 @@ -0,0 +1,239 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_valgrind_check.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_VALGRIND_DFLT(memcheck|helgrind|drd|sgcheck, on|off) +# AX_VALGRIND_CHECK() +# +# DESCRIPTION +# +# AX_VALGRIND_CHECK checks whether Valgrind is present and, if so, allows +# running `make check` under a variety of Valgrind tools to check for +# memory and threading errors. +# +# Defines VALGRIND_CHECK_RULES which should be substituted in your +# Makefile; and $enable_valgrind which can be used in subsequent configure +# output. VALGRIND_ENABLED is defined and substituted, and corresponds to +# the value of the --enable-valgrind option, which defaults to being +# enabled if Valgrind is installed and disabled otherwise. Individual +# Valgrind tools can be disabled via --disable-valgrind-<tool>, the +# default is configurable via the AX_VALGRIND_DFLT command or is to use +# all commands not disabled via AX_VALGRIND_DFLT. All AX_VALGRIND_DFLT +# calls must be made before the call to AX_VALGRIND_CHECK. +# +# If unit tests are written using a shell script and automake's +# LOG_COMPILER system, the $(VALGRIND) variable can be used within the +# shell scripts to enable Valgrind, as described here: +# +# https://www.gnu.org/software/gnulib/manual/html_node/Running-self_002dtests-under-valgrind.html +# +# Usage example: +# +# configure.ac: +# +# AX_VALGRIND_DFLT([sgcheck], [off]) +# AX_VALGRIND_CHECK +# +# in each Makefile.am with tests: +# +# @VALGRIND_CHECK_RULES@ +# VALGRIND_SUPPRESSIONS_FILES = my-project.supp +# EXTRA_DIST = my-project.supp +# +# This results in a "check-valgrind" rule being added. Running `make +# check-valgrind` in that directory will recursively run the module's test +# suite (`make check`) once for each of the available Valgrind tools (out +# of memcheck, helgrind and drd) while the sgcheck will be skipped unless +# enabled again on the commandline with --enable-valgrind-sgcheck. The +# results for each check will be output to test-suite-$toolname.log. The +# target will succeed if there are zero errors and fail otherwise. +# +# Alternatively, a "check-valgrind-$TOOL" rule will be added, for $TOOL in +# memcheck, helgrind, drd and sgcheck. These are useful because often only +# some of those tools can be ran cleanly on a codebase. +# +# The macro supports running with and without libtool. +# +# LICENSE +# +# Copyright (c) 2014, 2015, 2016 Philip Withnall <[email protected]> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 17 + +dnl Configured tools +m4_define([valgrind_tool_list], [[memcheck], [helgrind], [drd], [sgcheck]]) +m4_set_add_all([valgrind_exp_tool_set], [sgcheck]) +m4_foreach([vgtool], [valgrind_tool_list], + [m4_define([en_dflt_valgrind_]vgtool, [on])]) + +AC_DEFUN([AX_VALGRIND_DFLT],[ + m4_define([en_dflt_valgrind_$1], [$2]) +])dnl + +AM_EXTRA_RECURSIVE_TARGETS([check-valgrind]) +m4_foreach([vgtool], [valgrind_tool_list], + [AM_EXTRA_RECURSIVE_TARGETS([check-valgrind-]vgtool)]) + +AC_DEFUN([AX_VALGRIND_CHECK],[ + dnl Check for --enable-valgrind + AC_ARG_ENABLE([valgrind], + [AS_HELP_STRING([--enable-valgrind], [Whether to enable Valgrind on the unit tests])], + [enable_valgrind=$enableval],[enable_valgrind=]) + + AS_IF([test "$enable_valgrind" != "no"],[ + # Check for Valgrind. + AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind]) + AS_IF([test "$VALGRIND" = ""],[ + AS_IF([test "$enable_valgrind" = "yes"],[ + AC_MSG_ERROR([Could not find valgrind; either install it or reconfigure with --disable-valgrind]) + ],[ + enable_valgrind=no + ]) + ],[ + enable_valgrind=yes + ]) + ]) + + AM_CONDITIONAL([VALGRIND_ENABLED],[test "$enable_valgrind" = "yes"]) + AC_SUBST([VALGRIND_ENABLED],[$enable_valgrind]) + + # Check for Valgrind tools we care about. + [valgrind_enabled_tools=] + m4_foreach([vgtool],[valgrind_tool_list],[ + AC_ARG_ENABLE([valgrind-]vgtool, + m4_if(m4_defn([en_dflt_valgrind_]vgtool),[off],dnl +[AS_HELP_STRING([--enable-valgrind-]vgtool, [Whether to use ]vgtool[ during the Valgrind tests])],dnl +[AS_HELP_STRING([--disable-valgrind-]vgtool, [Whether to skip ]vgtool[ during the Valgrind tests])]), + [enable_valgrind_]vgtool[=$enableval], + [enable_valgrind_]vgtool[=]) + AS_IF([test "$enable_valgrind" = "no"],[ + enable_valgrind_]vgtool[=no], + [test "$enable_valgrind_]vgtool[" ]dnl +m4_if(m4_defn([en_dflt_valgrind_]vgtool), [off], [= "yes"], [!= "no"]),[ + AC_CACHE_CHECK([for Valgrind tool ]vgtool, + [ax_cv_valgrind_tool_]vgtool,[ + ax_cv_valgrind_tool_]vgtool[=no + m4_set_contains([valgrind_exp_tool_set],vgtool, + [m4_define([vgtoolx],[exp-]vgtool)], + [m4_define([vgtoolx],vgtool)]) + AS_IF([`$VALGRIND --tool=]vgtoolx[ --help >/dev/null 2>&1`],[ + ax_cv_valgrind_tool_]vgtool[=yes + ]) + ]) + AS_IF([test "$ax_cv_valgrind_tool_]vgtool[" = "no"],[ + AS_IF([test "$enable_valgrind_]vgtool[" = "yes"],[ + AC_MSG_ERROR([Valgrind does not support ]vgtool[; reconfigure with --disable-valgrind-]vgtool) + ],[ + enable_valgrind_]vgtool[=no + ]) + ],[ + enable_valgrind_]vgtool[=yes + ]) + ]) + AS_IF([test "$enable_valgrind_]vgtool[" = "yes"],[ + valgrind_enabled_tools="$valgrind_enabled_tools ]m4_bpatsubst(vgtool,[^exp-])[" + ]) + AC_SUBST([ENABLE_VALGRIND_]vgtool,[$enable_valgrind_]vgtool) + ]) + AC_SUBST([valgrind_tools],["]m4_join([ ], valgrind_tool_list)["]) + AC_SUBST([valgrind_enabled_tools],[$valgrind_enabled_tools]) + +[VALGRIND_CHECK_RULES=' +# Valgrind check +# +# Optional: +# - VALGRIND_SUPPRESSIONS_FILES: Space-separated list of Valgrind suppressions +# files to load. (Default: empty) +# - VALGRIND_FLAGS: General flags to pass to all Valgrind tools. +# (Default: --num-callers=30) +# - VALGRIND_$toolname_FLAGS: Flags to pass to Valgrind $toolname (one of: +# memcheck, helgrind, drd, sgcheck). (Default: various) + +# Optional variables +VALGRIND_SUPPRESSIONS ?= $(addprefix --suppressions=,$(VALGRIND_SUPPRESSIONS_FILES)) +VALGRIND_FLAGS ?= --num-callers=30 +VALGRIND_memcheck_FLAGS ?= --leak-check=full --show-reachable=no +VALGRIND_helgrind_FLAGS ?= --history-level=approx +VALGRIND_drd_FLAGS ?= +VALGRIND_sgcheck_FLAGS ?= + +# Internal use +valgrind_log_files = $(addprefix test-suite-,$(addsuffix .log,$(valgrind_tools))) + +valgrind_memcheck_flags = --tool=memcheck $(VALGRIND_memcheck_FLAGS) +valgrind_helgrind_flags = --tool=helgrind $(VALGRIND_helgrind_FLAGS) +valgrind_drd_flags = --tool=drd $(VALGRIND_drd_FLAGS) +valgrind_sgcheck_flags = --tool=exp-sgcheck $(VALGRIND_sgcheck_FLAGS) + +valgrind_quiet = $(valgrind_quiet_$(V)) +valgrind_quiet_ = $(valgrind_quiet_$(AM_DEFAULT_VERBOSITY)) +valgrind_quiet_0 = --quiet +valgrind_v_use = $(valgrind_v_use_$(V)) +valgrind_v_use_ = $(valgrind_v_use_$(AM_DEFAULT_VERBOSITY)) +valgrind_v_use_0 = @echo " USE " $(patsubst check-valgrind-%-am,%,$''@):; + +# Support running with and without libtool. +ifneq ($(LIBTOOL),) +valgrind_lt = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=execute +else +valgrind_lt = +endif + +# Use recursive makes in order to ignore errors during check +check-valgrind-am: +ifeq ($(VALGRIND_ENABLED),yes) + $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k \ + $(foreach tool, $(valgrind_enabled_tools), check-valgrind-$(tool)) +else + @echo "Need to reconfigure with --enable-valgrind" +endif + +# Valgrind running +VALGRIND_TESTS_ENVIRONMENT = \ + $(TESTS_ENVIRONMENT) \ + env VALGRIND=$(VALGRIND) \ + G_SLICE=always-malloc,debug-blocks \ + G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly + +VALGRIND_LOG_COMPILER = \ + $(valgrind_lt) \ + $(VALGRIND) $(VALGRIND_SUPPRESSIONS) --error-exitcode=1 $(VALGRIND_FLAGS) + +define valgrind_tool_rule +check-valgrind-$(1)-am: +ifeq ($$(VALGRIND_ENABLED)-$$(ENABLE_VALGRIND_$(1)),yes-yes) +ifneq ($$(TESTS),) + $$(valgrind_v_use)$$(MAKE) check-TESTS \ + TESTS_ENVIRONMENT="$$(VALGRIND_TESTS_ENVIRONMENT)" \ + LOG_COMPILER="$$(VALGRIND_LOG_COMPILER)" \ + LOG_FLAGS="$$(valgrind_$(1)_flags)" \ + TEST_SUITE_LOG=test-suite-$(1).log +endif +else ifeq ($$(VALGRIND_ENABLED),yes) + @echo "Need to reconfigure with --enable-valgrind-$(1)" +else + @echo "Need to reconfigure with --enable-valgrind" +endif +endef + +$(foreach tool,$(valgrind_tools),$(eval $(call valgrind_tool_rule,$(tool)))) + +A''M_DISTCHECK_CONFIGURE_FLAGS ?= +A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-valgrind + +MOSTLYCLEANFILES ?= +MOSTLYCLEANFILES += $(valgrind_log_files) + +.PHONY: check-valgrind $(add-prefix check-valgrind-,$(valgrind_tools)) +'] + + AC_SUBST([VALGRIND_CHECK_RULES]) + m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([VALGRIND_CHECK_RULES])]) +]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/configure.ac new/telemetrics-client-2.3.5+git20200224.c3b8d81/configure.ac --- old/telemetrics-client-2.3.2+git20191217.8ca2993/configure.ac 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/configure.ac 2020-02-24 22:37:06.000000000 +0100 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([telemetrics-client], [2.3.2], [https://clearlinux.org/]) +AC_INIT([telemetrics-client], [2.3.5], [https://clearlinux.org/]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([1.14 -Wall -Werror -Wno-extra-portability foreign subdir-objects]) AM_SILENT_RULES([yes]) @@ -20,6 +20,14 @@ AC_PROG_LN_S AC_PROG_MAKE_SET +# Valgrind check +AX_VALGRIND_DFLT(memcheck, on) +AX_VALGRIND_DFLT(helgrind, off) +AX_VALGRIND_DFLT(drd, off) +AX_VALGRIND_DFLT(sgcheck, off) + +AX_VALGRIND_CHECK + # Checks for libraries. # check >= 0.9.12 is required for TAP output @@ -171,4 +179,6 @@ socketdir: $socketpath loglevel: $loglevel logtype: $logtype + +valgrind: $enable_valgrind ]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/src/configuration.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/configuration.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/src/configuration.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/configuration.c 2020-02-24 22:37:06.000000000 +0100 @@ -152,6 +152,18 @@ return true; } +/* Needed for unit testing */ +void free_config_struct(struct configuration *config) +{ + if (keyfile != NULL) { + nc_hashmap_free(keyfile); + } + + for (int i = 0; i < CONF_STR_MAX; i++) { + free(config->strValues[i]); + } +} + bool read_config_from_file(char *config_file, struct configuration *config) { if (keyfile != NULL) { @@ -274,6 +286,14 @@ free(config_file); } } + +/* Needed for unit testing */ +void free_config_file(void) +{ + if (config_file) { + free(config_file); + } +} const char *server_addr_config() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/hprobe.timer new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/data/hprobe.timer --- old/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/hprobe.timer 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/data/hprobe.timer 2020-02-24 22:37:06.000000000 +0100 @@ -5,6 +5,7 @@ [Timer] OnCalendar=daily AccuracySec=12h +RandomizedDelaySec=21600 Persistent=true [Install] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/klogscanner.service.in new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/data/klogscanner.service.in --- old/telemetrics-client-2.3.2+git20191217.8ca2993/src/data/klogscanner.service.in 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/data/klogscanner.service.in 2020-02-24 22:37:06.000000000 +0100 @@ -1,5 +1,6 @@ [Unit] Description=Telemetrics Kernel Log Scanner +ConditionVirtualization=!container Requires=telemprobd.socket After=telemprobd.socket diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/crash_probe.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/probes/crash_probe.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/crash_probe.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/probes/crash_probe.c 2020-02-24 22:37:06.000000000 +0100 @@ -396,6 +396,7 @@ nc_string_free(*backtrace); } *backtrace = nc_string_dup(""); + frame_counter = 0; if (dwfl_getthreads(d_core, thread_cb, backtrace) != DWARF_CB_OK) { /* We aborted unwinding, due to too many frames. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/oops_parser.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/probes/oops_parser.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/src/probes/oops_parser.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/probes/oops_parser.c 2020-02-24 22:37:06.000000000 +0100 @@ -577,6 +577,10 @@ while (*head != NULL) { frame = (*head)->next; + // First free memory allocation for function name + if ((*head)->function) { + free((*head)->function); + } free(*head); *head = frame; } @@ -584,8 +588,8 @@ /* * Function parses lines of the format : - * CPU: 2 PID: 6429 Comm: insmod Tainted: P OE 3.19.0-18-generic #18-Ubuntu$ - * CPU: 2 PID: 0 Comm: swapper/2 Not tainted 3.10.4-100.fc18.x86_64 #1 + * CPU: 2 PID: 6429 Comm: insmod Tainted: POE 3.19.0-18-generic #18-Ubuntu$ + * CPU: 2 PID: 0 Comm: swapper/2 Not tainted 3.10.4-100.fc18.x86_64 #1 * CPU: 3 PID: 0 Comm: swapper/3 Not tainted 4.0.5-300.fc22.x86_64 #1 */ static void parse_kernel_cpu_line(char *line, char **kernel_version, char **tainted) @@ -834,6 +838,15 @@ if (str_starts_with_casei(line, "CPU: ") || str_starts_with_casei(line, "PID: ")) { + /* Can't assume that these variables (tainted, + * an kernel_version) are not already allocated + * otherwise it will leak memory */ + if (tainted) { + free(tainted); + } + if (kernel_version) { + free(kernel_version); + } parse_kernel_cpu_line(line, &kernel_version, &tainted); continue; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/src/telemctl.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/telemctl.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/src/telemctl.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/telemctl.c 2020-02-24 22:37:06.000000000 +0100 @@ -471,7 +471,7 @@ static char* concatargs(int argc, char** argv) { - size_t len = strlen("telem_journal") + 1; + size_t len = 1 + strlen("telem_journal "); for (int i = 2; i < argc; i++) { len += strlen(argv[i]) + 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/src/telemdaemon.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/telemdaemon.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/src/telemdaemon.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/telemdaemon.c 2020-02-24 22:37:06.000000000 +0100 @@ -354,12 +354,21 @@ buf += cfg_info_size; header_size = *(uint32_t *)buf; + /* Header size can not be bigger than buffer size bail out early */ + if ((uint32_t)header_size >= (uint32_t)cl->size) { + return; + } message_size = cl->size - (cfg_info_size + header_size); - telem_debug("DEBUG: cl->size: %zu\n", cl->size); - telem_debug("DEBUG: header_size: %zu\n", header_size); - telem_debug("DEBUG: message_size: %zu\n", message_size); - telem_debug("DEBUG: cfg_info_size: %zu\n", cfg_info_size); - assert(message_size > 0); //TODO:Check for min and max limits + telem_debug("DEBUG: cl->size: %ld\n", cl->size); + telem_debug("DEBUG: header_size: %ld\n", header_size); + telem_debug("DEBUG: message_size: %ld\n", message_size); + telem_debug("DEBUG: cfg_info_size: %ld\n", cfg_info_size); + telem_debug("Total: %zu\n", header_size + cfg_info_size + message_size); + /* Check message size bounds */ + if (message_size <= 0 || message_size > MAX_PAYLOAD_LENGTH) { + telem_log(LOG_INFO, "Record message size out of bounds\n"); + return; + } msg = (char *)buf + sizeof(uint32_t); /* Copying the headers as strtok modifies the orginal buffer */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/src/telempostdaemon.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/telempostdaemon.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/src/telempostdaemon.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/telempostdaemon.c 2020-02-24 22:37:06.000000000 +0100 @@ -490,7 +490,7 @@ return ret; } -bool process_staged_record(char *filename, bool is_retry, TelemPostDaemon *daemon) +bool process_staged_record(char *filename, TelemPostDaemon *daemon) { int k; bool ret = false; @@ -530,20 +530,12 @@ goto end_processing_file; } - /* Retries should not be recorded */ - if (is_retry == false) { - /** Journal entry **/ - save_entry_to_journal(daemon, current_time, headers); - /** Record retention **/ - apply_retention_policies(daemon, body); - } - /** Record delivery **/ if (!daemon->record_server_delivery_enabled) { telem_log(LOG_INFO, "record server delivery disabled\n"); // Not an error condition ret = true; - goto end_processing_file; + goto end_record_delivery; } /** Spool policies **/ @@ -571,6 +563,17 @@ /** Deliver or spool **/ ret = deliver_record(daemon, headers, body, cfg_file); +end_record_delivery: + /** Save record once it is properly delivered, if record + * is spooled the record is not saved to journal until + * delievered on a re-try **/ + if (ret) { + /** Save to journal **/ + save_entry_to_journal(daemon, current_time, headers); + /** Record retention **/ + apply_retention_policies(daemon, body); + } + end_processing_file: /** Update spool size if record will be removed **/ if (ret) { @@ -625,7 +628,7 @@ telem_log(LOG_ERR, "Failed to allocate memory for staging record full path\n"); exit(EXIT_FAILURE); } - if (process_staged_record(record_path, true, daemon)) { + if (process_staged_record(record_path, daemon)) { unlink(record_path); processed++; } @@ -721,7 +724,7 @@ exit(EXIT_FAILURE); } /* Process inotify event */ - if (process_staged_record(record_name, false, daemon)) { + if (process_staged_record(record_name, daemon)) { unlink(record_name); } free(record_name); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/src/telempostdaemon.h new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/telempostdaemon.h --- old/telemetrics-client-2.3.2+git20191217.8ca2993/src/telempostdaemon.h 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/src/telempostdaemon.h 2020-02-24 22:37:06.000000000 +0100 @@ -85,11 +85,9 @@ * Processed record written on disk * * @param filename a pointor to record on disk - * @param is_retry a boolean value that indicates if - * the record has been previously processed. * @param daemon post to telemetry post daemon */ -bool process_staged_record(char *filename, bool is_retry, TelemPostDaemon *daemon); +bool process_staged_record(char *filename, TelemPostDaemon *daemon); /** * Scans staging directory to process files that were @@ -107,6 +105,7 @@ * @param body a pointer to the payload * @param cfg_file a pointer to a non-default configuration * file to be used. + * @return true if successful, false otherwise */ bool post_record_http(char *headers[], char *body, char *cfg_file); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_config.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/check_config.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_config.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/check_config.c 2020-02-24 22:37:06.000000000 +0100 @@ -14,8 +14,10 @@ * details. */ +#include <stdlib.h> #include <check.h> #include "configuration.h" +#include "configuration_check.h" START_TEST(check_read_config_for_invalid_file) { @@ -52,6 +54,7 @@ "X-Telemetry-TID: 6907c830-eed9-4ce9-81ae-76daf8d88f0f"); ck_assert(config.boolValues[CONF_DAEMON_RECYCLING_ENABLED] == true); + free_config_struct(&config); } END_TEST @@ -80,6 +83,8 @@ ck_assert(config.boolValues[CONF_DAEMON_RECYCLING_ENABLED] == DEFAULT_DAEMON_RECYCLING_ENABLED); ck_assert(config.boolValues[CONF_RECORD_RETENTION_ENABLED] == DEFAULT_RECORD_RETENTION_ENABLED); ck_assert(config.boolValues[CONF_RECORD_SERVER_DELIVERY_ENABLED] == DEFAULT_RECORD_SERVER_DELIVERY_ENABLED); + + free_config_struct(&config); } END_TEST @@ -110,6 +115,8 @@ ck_assert(config.boolValues[CONF_DAEMON_RECYCLING_ENABLED] == DEFAULT_DAEMON_RECYCLING_ENABLED); ck_assert(config.boolValues[CONF_RECORD_RETENTION_ENABLED] == DEFAULT_RECORD_RETENTION_ENABLED); ck_assert(config.boolValues[CONF_RECORD_SERVER_DELIVERY_ENABLED] == DEFAULT_RECORD_SERVER_DELIVERY_ENABLED); + + free_config_struct(&config); } END_TEST @@ -123,6 +130,8 @@ ck_assert(config.boolValues[CONF_RECORD_RETENTION_ENABLED] == true); ck_assert(config.boolValues[CONF_RECORD_SERVER_DELIVERY_ENABLED] == false); + + free_config_struct(&config); } END_TEST @@ -176,6 +185,7 @@ { Suite *s; SRunner *sr; + int failed; s = config_suite(); sr = srunner_create(s); @@ -186,13 +196,13 @@ srunner_set_tap(sr, "-"); srunner_run_all(sr, CK_SILENT); - // failed = srunner_ntests_failed(sr); + failed = srunner_ntests_failed(sr); srunner_free(sr); // if you want the TAP driver to report a hard error based // on certain conditions (e.g. number of failed tests, etc.), // return non-zero here instead. - return 0; + return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* vi: set ts=8 sw=8 sts=4 et tw=80 cino=(0: */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_journal.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/check_journal.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_journal.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/check_journal.c 2020-02-24 22:37:06.000000000 +0100 @@ -17,6 +17,7 @@ #include <check.h> #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include "common.h" #include "journal/journal.h" @@ -239,6 +240,7 @@ { Suite *s; SRunner *sr; + int failed; s = config_suite(); sr = srunner_create(s); @@ -249,13 +251,13 @@ srunner_set_tap(sr, "-"); srunner_run_all(sr, CK_SILENT); - // failed = srunner_ntests_failed(sr); + failed = srunner_ntests_failed(sr); srunner_free(sr); // if you want the TAP driver to report a hard error based // on certain conditions (e.g. number of failed tests, etc.), // return non-zero here instead. - return 0; + return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* vi: set ts=8 sw=8 sts=4 et tw=80 cino=(0: */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_libtelemetry.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/check_libtelemetry.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_libtelemetry.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/check_libtelemetry.c 2020-02-24 22:37:06.000000000 +0100 @@ -243,9 +243,8 @@ void event_id_teardown(void) { - if (ref) { - free(ref); - } + // Free record + create_teardown(); free(original_event_id); } @@ -292,6 +291,7 @@ { Suite *s; SRunner *sr; + int failed; s = lib_suite(); sr = srunner_create(s); @@ -299,11 +299,13 @@ srunner_set_log(sr, NULL); srunner_set_tap(sr, "-"); + // set CK_NOFORK to attach gdb + // srunner_set_fork_status(sr, CK_NOFORK); srunner_run_all(sr, CK_SILENT); - + failed = srunner_ntests_failed(sr); srunner_free(sr); - return 0; + return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* vi: set ts=8 sw=8 sts=4 et tw=80 cino=(0: */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_postd.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/check_postd.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_postd.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/check_postd.c 2020-02-24 22:37:06.000000000 +0100 @@ -62,7 +62,7 @@ bool success; char *filename = ABSTOPSRCDIR "/tests/telempostd/empty_message"; - success = process_staged_record(filename, false, &tdaemon); + success = process_staged_record(filename, &tdaemon); // Return true to remove corrupted record ck_assert(success == true); } @@ -75,7 +75,7 @@ bool success; char *filename = ABSTOPSRCDIR "/tests/telempostd/incorrect_message"; - success = process_staged_record(filename, false, &tdaemon); + success = process_staged_record(filename, &tdaemon); // Return true to remove corrupted record ck_assert(success == true); } @@ -88,7 +88,7 @@ bool success; char *filename = ABSTOPSRCDIR "/tests/telempostd/correct_message"; - success = process_staged_record(filename, false, &tdaemon); + success = process_staged_record(filename, &tdaemon); ck_assert(success == true); } END_TEST @@ -100,7 +100,7 @@ bool success; char *filename = ABSTOPSRCDIR "/tests/telempostd/incorrect_headers"; - success = process_staged_record(filename, false, &tdaemon); + success = process_staged_record(filename, &tdaemon); // Return true to remove corrupted record ck_assert(success == true); } @@ -421,6 +421,7 @@ { Suite *s; SRunner *sr; + int failed; s = config_suite(); sr = srunner_create(s); @@ -431,13 +432,13 @@ srunner_set_tap(sr, "-"); srunner_run_all(sr, CK_SILENT); - // failed = srunner_ntests_failed(sr); + failed = srunner_ntests_failed(sr); srunner_free(sr); // if you want the TAP driver to report a hard error based // on certain conditions (e.g. number of failed tests, etc.), // return non-zero here instead. - return 0; + return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* vi: set ts=8 sw=8 sts=4 et tw=80 cino=(0: */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_probd.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/check_probd.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_probd.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/check_probd.c 2020-02-24 22:37:06.000000000 +0100 @@ -22,6 +22,7 @@ #include <unistd.h> #include "configuration.h" +#include "configuration_check.h" #include "telemdaemon.h" #include "common.h" @@ -61,12 +62,19 @@ initialize_probe_daemon(&tdaemon); } +void teardown(void) +{ + free_config_file(); +} + START_TEST(check_daemon_is_initialized) { setup(); ck_assert(tdaemon.nfds == 0); ck_assert(tdaemon.pollfds == NULL); + + teardown(); } END_TEST @@ -84,9 +92,9 @@ int fd = 1; int short events = 1; - add_pollfd(&tdaemon, fd, events); - add_pollfd(&tdaemon, ++fd, events); - add_pollfd(&tdaemon, ++fd, events); + add_pollfd(&tdaemon, 1, events); + add_pollfd(&tdaemon, 2, events); + add_pollfd(&tdaemon, 3, events); ck_assert_msg(tdaemon.nfds == 3, "Failed to add pollfd"); fd = get_poll_fd(&tdaemon, 0); @@ -110,6 +118,10 @@ ck_assert_msg(tdaemon.nfds == 0, "Failed to delete pollfd"); fd = get_poll_fd(&tdaemon, 0); ck_assert(fd == -1); + + /* Cleaning alloctions */ + free(tdaemon.pollfds); + teardown(); } END_TEST @@ -133,6 +145,8 @@ remove_client(&(tdaemon.client_head), cl3); //ck_assert(tdaemon.client_head.lh_first == NULL); ck_assert_msg(is_client_list_empty(&(tdaemon.client_head)), "Failed to remove clients\n"); + + teardown(); } END_TEST @@ -171,6 +185,8 @@ ck_assert_msg(is_client_list_empty(&(tdaemon.client_head)), "Failed to remove client with no data\n"); ck_assert_msg(tdaemon.nfds == 0, "Failed to remove poll fd for client with n data\n"); close(server_fd); + + teardown(); } END_TEST @@ -197,6 +213,8 @@ ck_assert_msg(is_client_list_empty(&(tdaemon.client_head)), "Failed to remove client with no data\n"); ck_assert_msg(tdaemon.nfds == 0, "Failed to remove poll fd for client with n data\n"); close(server_fd); + + teardown(); } END_TEST @@ -228,6 +246,8 @@ ck_assert_msg(is_client_list_empty(&(tdaemon.client_head)), "Failed to remove client with no data\n"); ck_assert_msg(tdaemon.nfds == 0, "Failed to remove poll fd for client with n data\n"); close(server_fd); + + teardown(); } END_TEST @@ -332,6 +352,8 @@ ck_assert_msg(tdaemon.nfds == 0, "Failed to remove poll fd for client with incorrect headers\n"); close(server_fd); free(record); + + teardown(); } END_TEST @@ -361,6 +383,7 @@ { Suite *s; SRunner *sr; + int failed; s = config_suite(); sr = srunner_create(s); @@ -370,14 +393,16 @@ srunner_set_log(sr, NULL); srunner_set_tap(sr, "-"); + // set CK_NOFORK to attach gdb + // srunner_set_fork_status(sr, CK_NOFORK); srunner_run_all(sr, CK_SILENT); - // failed = srunner_ntests_failed(sr); + failed = srunner_ntests_failed(sr); srunner_free(sr); // if you want the TAP driver to report a hard error based // on certain conditions (e.g. number of failed tests, etc.), // return non-zero here instead. - return 0; + return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* vi: set ts=8 sw=8 sts=4 et tw=80 cino=(0: */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_probes.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/check_probes.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/check_probes.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/check_probes.c 2020-02-24 22:37:06.000000000 +0100 @@ -57,6 +57,10 @@ oops_parser_init(callback_func); split_buf_by_line(buf, buflen); } + + if (buf) { + free(buf); + } } // Tests for checking backtrace @@ -249,6 +253,8 @@ ck_assert(strstr(pl->str, "#24 sys_ioctl")); ck_assert(strstr(pl->str, "#25 sysenter_past_esp")); ck_assert(strstr(pl->str, "#26 quirk_ali7101_acpi")); + + nc_string_free(pl); } END_TEST @@ -679,27 +685,6 @@ tcase_add_test(t, bug_kernel_handle_payload); tcase_add_test(t, bug_kernel_handle_payload_new_format); - //TODO fix - //tcase_add_test(t, badness_payload); - -/* - tcase_add_test(t, watchdog_oops); - tcase_add_test(t, warning_oops); - tcase_add_test(t, warn_on_oops); - tcase_add_test(t, two_warnings_oops); - tcase_add_test(t, sysctl1_oops); - tcase_add_test(t, sysctl2_oops); - tcase_add_test(t, softlockup_oops); - tcase_add_test(t, rtnl_oops); - tcase_add_test(t, kernel_null_pointer_oops); - tcase_add_test(t, kernel_bug_oops); - tcase_add_test(t, irq_oops); - tcase_add_test(t, general_protection_fault_oops); - tcase_add_test(t, double_fault_oops); - tcase_add_test(t, bad_page_map_oops); - tcase_add_test(t, bug_kernel_handle_oops); - tcase_add_test(t, badness_oops); - */ suite_add_tcase(s, t); return s; @@ -709,6 +694,7 @@ { Suite *s; SRunner *sr; + int failed; s = config_suite(); sr = srunner_create(s); @@ -720,14 +706,16 @@ srunner_set_log(sr, NULL); srunner_set_tap(sr, "-"); + // set CK_NOFORK to attach gdb + // srunner_set_fork_status(sr, CK_NOFORK); srunner_run_all(sr, CK_SILENT); - // failed = srunner_ntests_failed(sr); + failed = srunner_ntests_failed(sr); srunner_free(sr); // if you want the TAP driver to report a hard error based // on certain conditions (e.g. number of failed tests, etc.), // return non-zero here instead. - return 0; + return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } /* vi: set ts=8 sw=8 sts=4 et tw=80 cino=(0: */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/configuration_check.h new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/configuration_check.h --- old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/configuration_check.h 1970-01-01 01:00:00.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/configuration_check.h 2020-02-24 22:37:06.000000000 +0100 @@ -0,0 +1,24 @@ +/* + * This program is part of the Clear Linux Project + * + * Copyright 2020 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify it under + * the terms and conditions of the GNU Lesser General Public License, as + * published by the Free Software Foundation; either version 2.1 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + +#pragma once + +/* Function used only for unit testing */ +/* Frees configuration structure */ +void free_config_struct(struct configuration *config); + +/* Frees configuration file name string */ +void free_config_file(void); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/local.mk new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/local.mk --- old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/local.mk 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/local.mk 2020-02-24 22:37:06.000000000 +0100 @@ -1,4 +1,6 @@ -EXTRA_DIST += %D%/taplib.sh +EXTRA_DIST += \ + %D%/taplib.sh \ + %D%/telemetrics-client.supp TEST_EXTENSIONS = .sh @@ -22,6 +24,7 @@ %D%/create-core.sh %C%_check_config_SOURCES = \ + %D%/configuration_check.h \ %D%/check_config.c %C%_check_config_CFLAGS = \ @@ -40,6 +43,7 @@ endif %C%_check_probd_SOURCES = \ + %D%/configuration_check.h \ %D%/check_probd.c \ src/telemdaemon.c \ src/telemdaemon.h \ @@ -196,4 +200,14 @@ endif endif +@VALGRIND_CHECK_RULES@ +VALGRIND_SUPPRESSIONS_FILES = %D%/telemetrics-client.supp +VALGRIND_FLAGS = \ + --error-exitcode=1 \ + --track-origins=yes \ + --leak-resolution=low \ + --verbose \ + --leak-check=full \ + --show-possibly-lost=no + # vim: filetype=automake tabstop=8 shiftwidth=8 noexpandtab diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/read_oopsfile.c new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/read_oopsfile.c --- old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/read_oopsfile.c 2019-12-18 03:39:20.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/read_oopsfile.c 2020-02-24 22:37:06.000000000 +0100 @@ -1,3 +1,19 @@ +/* + * This program is part of the Clear Linux Project + * + * Copyright 2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify it under + * the terms and conditions of the GNU Lesser General Public License, as + * published by the Free Software Foundation; either version 2.1 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ + #include <stdlib.h> #include <stdio.h> #include <errno.h> @@ -36,26 +52,18 @@ if (fread(bufp, sizeof(char), buflen, fp) != buflen) { telem_log(LOG_ERR, "Error reading file\n"); } else { - bufp[++buflen] = '\0'; + bufp[buflen] = '\0'; } } if (fclose(fp) != 0) { printf("Error closing file: %s\n", strerror(errno)); } - //free(bufp); } else { telem_log(LOG_ERR, "Wrong file pathname: %s", filepath); } return bufp; } -/* - char *getbuf() - { - - return bufp; - } - */ unsigned long getbuflen() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/telemetrics-client.supp new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/telemetrics-client.supp --- old/telemetrics-client-2.3.2+git20191217.8ca2993/tests/telemetrics-client.supp 1970-01-01 01:00:00.000000000 +0100 +++ new/telemetrics-client-2.3.5+git20200224.c3b8d81/tests/telemetrics-client.supp 2020-02-24 22:37:06.000000000 +0100 @@ -0,0 +1,38 @@ +# This program is part of the Clear Linux Project +# +# Copyright 2020 Intel Corporation +# +# This program is free software; you can redistribute it and/or modify it under +# the terms and conditions of the GNU Lesser General Public License, as +# published by the Free Software Foundation; either version 2.1 of the License, +# or (at your option) any later version. +# +# This program is distributed in the hope it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. + + +# False positive when check is run with CK_FORK=yes +{ + ck_fork_yes_false_positive + Memcheck:Leak + fun:malloc + fun:UnknownInlinedFun + fun:UnknownInlinedFun + fun:tag_string_to_list + fun:UnknownInlinedFun + fun:srunner_run_tagged + fun:main +} + +# False positive returned by call to shell script from +# with in test. +{ + ck_shell_call + Memcheck:Leak + fun:malloc + fun:xmalloc + fun:set_default_locale + fun:main +}
