Control: tags -1 + patch Hello,
The attached debdiff disables the python plugin, since it's pure python2 stuff. (Also removes python plugin example from the shipped collectd.conf and updates package description.) While at it I also had to actually make the package build again, so bonus content included for that: I cherry-picked a bunch of upstream compiler warning fixes, before a warning in an external package header file finally forced me to look up how to disable -Werror which apparently there's a configure flag for which IMHO should always be used in release builds (and thus the debian package). Otherwise you'll have FTBFS bugs introduced from under you by changing dependencies and compilers. Finally the tests failed. Apparently gcc decides to optimize out a condition "if (ptr != NULL)" before doing "*ptr = '\0';" which results in a segfault. The reason for gcc doing this is likely that previously memcpy has been used on ptr, and you probably shouldn't assume using memcpy(NULL, ....) will work. I didn't find any fix for this upstream so did a quick hack myself for that. Regards, Andreas Henriksson
diff -Nru collectd-5.8.1/debian/changelog collectd-5.8.1/debian/changelog --- collectd-5.8.1/debian/changelog 2019-04-06 14:21:09.000000000 +0200 +++ collectd-5.8.1/debian/changelog 2019-11-06 22:34:37.000000000 +0100 @@ -1,3 +1,20 @@ +collectd (5.8.1-1.4) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Disable building python(2) plugin (Closes: #936318) + * Add debian/patches/fix-network-parse-strcpy-off-by-one.patch + - from upstream commit 28c83da870b4df4a311a5ef20a5ca37d3c84c638 + * Add debian/patches/fix-build-with-newer-gpsd.patch (Closes: #926528) + - from upstream commit 991a6d3fd38c2435d94de3853fda36b3330cf6ab + * Add debian/patches/fix-dpdk-deprecation-warn.patch + - from upstream commit 6f7193eb7af4a76239332988ac280 + * Argh! Still wont build.... add --disable-werror configure flag! + * Add fix-test-common-segfault.patch by yours truely! + - gcc will optimize out condition (since we've already written + to ptr using memcpy?). Thus dereference ptr even when it's NULL! + + -- Andreas Henriksson <andr...@fatal.se> Wed, 06 Nov 2019 22:34:37 +0100 + collectd (5.8.1-1.3) unstable; urgency=medium * Non-maintainer upload. diff -Nru collectd-5.8.1/debian/collectd.conf collectd-5.8.1/debian/collectd.conf --- collectd-5.8.1/debian/collectd.conf 2018-11-22 23:16:41.000000000 +0100 +++ collectd-5.8.1/debian/collectd.conf 2019-11-06 22:33:53.000000000 +0100 @@ -169,7 +169,6 @@ #LoadPlugin powerdns LoadPlugin processes #LoadPlugin protocols -#LoadPlugin python #LoadPlugin redis #LoadPlugin rrdcached LoadPlugin rrdtool @@ -1133,17 +1132,6 @@ # IgnoreSelected false #</Plugin> -#<Plugin python> -# ModulePath "/path/to/your/python/modules" -# LogTraces true -# Interactive true -# Import "spam" -# -# <Module spam> -# spam "wonderful" "lovely" -# </Module> -#</Plugin> - #<Plugin redis> # <Node example> # Host "redis.example.com" diff -Nru collectd-5.8.1/debian/control collectd-5.8.1/debian/control --- collectd-5.8.1/debian/control 2019-04-06 14:20:16.000000000 +0200 +++ collectd-5.8.1/debian/control 2019-11-06 22:33:05.000000000 +0100 @@ -65,7 +65,6 @@ protobuf-c-compiler, protobuf-compiler (>= 3.0.0), protobuf-compiler-grpc [amd64 arm64 armel armhf i386 ppc64el powerpc], - python-dev, riemann-c-client Build-Conflicts: libpthread-dev, libhal-dev Standards-Version: 4.2.1 @@ -189,7 +188,6 @@ * PowerDNS name server statistics: powerdns * number of processes: processes * information about network protocols: protocols - * embedded Python interpreter: python * Redis server statistics: redis * write data via the RRD accelerator daemon: rrdcached * output to RRD files: rrdtool diff -Nru collectd-5.8.1/debian/patches/fix-build-with-newer-gpsd.patch collectd-5.8.1/debian/patches/fix-build-with-newer-gpsd.patch --- collectd-5.8.1/debian/patches/fix-build-with-newer-gpsd.patch 1970-01-01 01:00:00.000000000 +0100 +++ collectd-5.8.1/debian/patches/fix-build-with-newer-gpsd.patch 2019-11-06 22:34:37.000000000 +0100 @@ -0,0 +1,36 @@ +From 991a6d3fd38c2435d94de3853fda36b3330cf6ab Mon Sep 17 00:00:00 2001 +From: Baruch Siach <bar...@tkos.co.il> +Date: Tue, 9 Oct 2018 19:57:21 +0300 +Subject: [PATCH] gps plugin: fix build with newer gpsd + +gpsd version 3.18 changed the prototype of gps_read(). Make the +gps_read() call depend on GPSD_API_MAJOR_VERSION to fix that. + +This fixes build failures like: + +gps.c: In function 'cgps_thread': +gps.c:144:11: error: too few arguments to function 'gps_read' + if (gps_read(&gpsd_conn) == -1) { + ^~~~~~~~ +--- + src/gps.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/gps.c b/src/gps.c +index 1d32d04926..b22c3a2e5e 100644 +--- a/src/gps.c ++++ b/src/gps.c +@@ -141,7 +141,12 @@ static void *cgps_thread(void *pData) { + continue; + } + +- if (gps_read(&gpsd_conn) == -1) { ++#if GPSD_API_MAJOR_VERSION > 6 ++ if (gps_read(&gpsd_conn, NULL, 0) == -1) ++#else ++ if (gps_read(&gpsd_conn) == -1) ++#endif ++ { + WARNING("gps plugin: incorrect data! (err_count: %d)", err_count); + err_count++; + diff -Nru collectd-5.8.1/debian/patches/fix-dpdk-deprecation-warn.patch collectd-5.8.1/debian/patches/fix-dpdk-deprecation-warn.patch --- collectd-5.8.1/debian/patches/fix-dpdk-deprecation-warn.patch 1970-01-01 01:00:00.000000000 +0100 +++ collectd-5.8.1/debian/patches/fix-dpdk-deprecation-warn.patch 2019-11-06 22:34:37.000000000 +0100 @@ -0,0 +1,46 @@ +From 6f7193eb7af4a76239332988ac2803eb2ce361d9 Mon Sep 17 00:00:00 2001 +From: Kevin Laatz <kevin.la...@intel.com> +Date: Mon, 25 Jun 2018 17:14:34 +0100 +Subject: [PATCH] dpdk: fix deprecation warning + +This fixes a warning produced by a change introduced in the latest DPDK +relase caused by a deprecation notice. + +Signed-off-by: Kevin Laatz <kevin.la...@intel.com> +--- + src/dpdkevents.c | 4 ++++ + src/utils_dpdk.c | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/src/dpdkevents.c b/src/dpdkevents.c +index 064dce1623..9fc42b336f 100644 +--- a/src/dpdkevents.c ++++ b/src/dpdkevents.c +@@ -420,7 +420,11 @@ static int dpdk_helper_link_status_get(dpdk_helper_ctx_t *phc) { + dpdk_events_ctx_t *ec = DPDK_EVENTS_CTX_GET(phc); + + /* get Link Status values from DPDK */ ++#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0) + uint8_t nb_ports = rte_eth_dev_count(); ++#else ++ uint8_t nb_ports = rte_eth_dev_count_avail(); ++#endif + if (nb_ports == 0) { + DPDK_CHILD_LOG("dpdkevent-helper: No DPDK ports available. " + "Check bound devices to DPDK driver.\n"); +diff --git a/src/utils_dpdk.c b/src/utils_dpdk.c +index 30a10574e9..07ec8aeedb 100644 +--- a/src/utils_dpdk.c ++++ b/src/utils_dpdk.c +@@ -853,7 +853,11 @@ uint128_t str_to_uint128(const char *str, int len) { + } + + uint8_t dpdk_helper_eth_dev_count() { ++#if RTE_VERSION < RTE_VERSION_NUM(18, 05, 0, 0) + uint8_t ports = rte_eth_dev_count(); ++#else ++ uint8_t ports = rte_eth_dev_count_avail(); ++#endif + if (ports == 0) { + ERROR( + "%s:%d: No DPDK ports available. Check bound devices to DPDK driver.\n", diff -Nru collectd-5.8.1/debian/patches/fix-network-parse-strcpy-off-by-one.patch collectd-5.8.1/debian/patches/fix-network-parse-strcpy-off-by-one.patch --- collectd-5.8.1/debian/patches/fix-network-parse-strcpy-off-by-one.patch 1970-01-01 01:00:00.000000000 +0100 +++ collectd-5.8.1/debian/patches/fix-network-parse-strcpy-off-by-one.patch 2019-11-06 22:34:37.000000000 +0100 @@ -0,0 +1,34 @@ +From 28c83da870b4df4a311a5ef20a5ca37d3c84c638 Mon Sep 17 00:00:00 2001 +From: Ruben Kerkhof <ru...@rubenkerkhof.com> +Date: Fri, 14 Dec 2018 17:27:44 +0100 +Subject: [PATCH] libcollectdclient: fix gcc warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +make[1]: Entering directory '/home/ruben/src/collectd' + CC src/libcollectdclient/libcollectdclient_la-network_parse.lo +In function ‘parse_string’, + inlined from ‘parse_identifier’ at src/libcollectdclient/network_parse.c:169:7, + inlined from ‘network_parse.constprop’ at src/libcollectdclient/network_parse.c:540:11: +src/libcollectdclient/network_parse.c:161:3: warning: ‘strncpy’ specified bound 64 equals destination size [-Wstringop-truncation] + strncpy(out, in, out_size); + ^~~~~~~~~~~~~~~~~~~~~~~~~~ +--- + src/libcollectdclient/network_parse.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/libcollectdclient/network_parse.c b/src/libcollectdclient/network_parse.c +index 73476fb7c8..14e8be57a7 100644 +--- a/src/libcollectdclient/network_parse.c ++++ b/src/libcollectdclient/network_parse.c +@@ -158,7 +158,8 @@ static int parse_string(void *payload, size_t payload_size, char *out, + (payload_size > out_size)) + return EINVAL; + +- strncpy(out, in, out_size); ++ strncpy(out, in, out_size - 1); ++ out[out_size - 1] = '\0'; + return 0; + } + diff -Nru collectd-5.8.1/debian/patches/fix-test-common-segfault.patch collectd-5.8.1/debian/patches/fix-test-common-segfault.patch --- collectd-5.8.1/debian/patches/fix-test-common-segfault.patch 1970-01-01 01:00:00.000000000 +0100 +++ collectd-5.8.1/debian/patches/fix-test-common-segfault.patch 2019-11-06 22:34:37.000000000 +0100 @@ -0,0 +1,17 @@ +--- a/src/daemon/common.c ++++ b/src/daemon/common.c +@@ -355,10 +355,14 @@ + if (field_len > avail) + field_len = avail; + ++ if (!ptr) ++ continue; ++ + memcpy(ptr, fields[i], field_len); + ptr += field_len; + + avail -= field_len; ++ /* XXX: the below condition will be optimized out by gcc! */ + if (ptr != NULL) + *ptr = 0; + } diff -Nru collectd-5.8.1/debian/patches/series collectd-5.8.1/debian/patches/series --- collectd-5.8.1/debian/patches/series 2018-12-25 12:07:38.000000000 +0100 +++ collectd-5.8.1/debian/patches/series 2019-11-06 22:34:37.000000000 +0100 @@ -6,3 +6,7 @@ liblvm2app_depreciation_warning.patch dpdk_configure_check.patch removed_checks_for_upper_limit_of_SENSORS_API.patch +fix-network-parse-strcpy-off-by-one.patch +fix-build-with-newer-gpsd.patch +fix-dpdk-deprecation-warn.patch +fix-test-common-segfault.patch diff -Nru collectd-5.8.1/debian/rules collectd-5.8.1/debian/rules --- collectd-5.8.1/debian/rules 2019-04-06 14:20:16.000000000 +0200 +++ collectd-5.8.1/debian/rules 2019-11-06 22:34:37.000000000 +0100 @@ -51,6 +51,9 @@ --localstatedir=/var --sysconfdir=/etc \ --with-perl-bindings="INSTALLDIRS=vendor INSTALL_BASE=" \ --without-libstatgrab \ + --without-libpython \ + --disable-python \ + --disable-werror \ --disable-static \ --disable-silent-rules \ --enable-all-plugins