Control: tags -1 + patch Please find attached a patch. As I know absolutely nothing about this package, I was unable to test it properly. I added the following snippet to /etc/ganglia/gmond.conf (taken from gmond.conf manpage):
collection_group { collect_every = 60 time_threshold = 300 metric { name_match = "multicpu_([a-z]+)([0-9]+)" value_threshold = 1.0 title = "CPU-\\2 \\1" } } The output of "gmond -m" doesn't change (maybe that's expected) but at least it doesn't crash. According to INSTALL (as well as my humble reading of the code), pcre is used only for parsing name_match in the configuration file. But it seems I cannot trigger a match or do something else improperly. Please test and let me know if corrections are needed.
>From 7d05aca52f9cf1b579b80f719bed47cfd6ba7b7b Mon Sep 17 00:00:00 2001 From: Yavor Doganov <ya...@gnu.org> Date: Tue, 5 Dec 2023 19:26:34 +0200 Subject: [PATCH] Port to PCRE2 (#1000041). --- debian/changelog | 5 ++ debian/control | 2 +- debian/patches/pcre2.patch | 130 +++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 4 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 debian/patches/pcre2.patch diff --git a/debian/changelog b/debian/changelog index 081dbec..7c78336 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,13 @@ ganglia (3.7.2-7) UNRELEASED; urgency=medium + [ Marcos Fouces ] * Remove Stuart from uploaders as he changed to the Emeritus status. (Closes: #1011995). + [ Yavor Doganov ] + * debian/patches/pcre2.patch: New; port to PCRE2 (Closes: #1000041). + * debian/control (Build-Depends): Replace libpcre3-dev with libpcre2-dev. + -- Marcos Fouces <mar...@debian.org> Sun, 29 May 2022 23:53:57 +0200 ganglia (3.7.2-6) unstable; urgency=medium diff --git a/debian/control b/debian/control index 406ff30..40ade70 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: net Priority: optional Maintainer: Marcos Fouces <mar...@debian.org> Homepage: http://ganglia.info/ -Build-Depends: debhelper-compat (=13), librrd-dev, libapr1-dev, libexpat1-dev, libconfuse-dev, po-debconf, libxml2-dev, libdbi0-dev, libpcre3-dev, gperf, rsync, libkvm-dev [kfreebsd-any], pkg-config, libz-dev, libtirpc-dev +Build-Depends: debhelper-compat (=13), librrd-dev, libapr1-dev, libexpat1-dev, libconfuse-dev, po-debconf, libxml2-dev, libdbi0-dev, libpcre2-dev, gperf, rsync, libkvm-dev [kfreebsd-any], pkg-config, libz-dev, libtirpc-dev Standards-Version: 4.6.0 Vcs-Git: https://salsa.debian.org/debian/ganglia.git Vcs-Browser: https://salsa.debian.org/debian/ganglia diff --git a/debian/patches/pcre2.patch b/debian/patches/pcre2.patch new file mode 100644 index 0000000..54ecaa0 --- /dev/null +++ b/debian/patches/pcre2.patch @@ -0,0 +1,130 @@ +Description: Port to PCRE2. +Bug-Debian: https://bugs.debian.org/1000041 +Author: Yavor Doganov <ya...@gnu.org> +Forwarded: no +Last-Update: 2023-12-05 +--- + +--- ganglia.orig/configure.ac ++++ ganglia/configure.ac +@@ -520,14 +520,20 @@ + echo "Added -L$libpcrepath/${LIB_SUFFIX} to LDFLAGS" + fi + if test x"$libpcre" == xyes ; then +- AC_CHECK_HEADERS([pcre/pcre.h pcre.h]) +- AC_CHECK_LIB(pcre, pcre_compile) +- if test x"$ac_cv_lib_pcre_pcre_compile" = xyes; then +- echo "Found a suitable pcre library" +- else +- echo "libpcre not found, specify --with-libpcre=no to build without PCRE support" +- exit 1; +- fi ++ AC_CHECK_HEADERS([pcre2.h], [], [], [[#define PCRE2_CODE_UNIT_WIDTH 8]]) ++ LIBS="$LIBS -lpcre2-8" ++ AC_MSG_CHECKING([for pcre2_match_data_create in -lpcre2-8]) ++ AC_LINK_IFELSE( ++ [AC_LANG_PROGRAM([[#define PCRE2_CODE_UNIT_WIDTH 8 ++ #include <pcre2.h> ++ ]], ++ [[pcre2_match_data *md; ++ md = pcre2_match_data_create (16, NULL);]])], ++ [AC_DEFINE([HAVE_LIBPCRE], [1], [Define if the PCRE2 library is available]) ++ AC_MSG_RESULT([yes]) ++ AC_MSG_RESULT([Found a suitable pcre library])], ++ [AC_MSG_RESULT([no]) ++ AC_MSG_FAILURE([libpcre not found, specify --with-libpcre=no to build without PCRE support], [1])]) + else + echo "building without PCRE support" + fi +--- ganglia.orig/gmond/gmond.c ++++ ganglia/gmond/gmond.c +@@ -38,11 +38,8 @@ + #include <apr_version.h> + + #ifdef HAVE_LIBPCRE +-#if defined (HAVE_PCRE_PCRE_H) +-#include <pcre/pcre.h> +-#else +-#include <pcre.h> +-#endif ++#define PCRE2_CODE_UNIT_WIDTH 8 ++#include <pcre2.h> + #endif + + #include "cmdline.h" /* generated by cmdline.sh which runs gengetopt */ +@@ -2650,10 +2647,11 @@ + + if(name_match != NULL) + { +- pcre *pcre_re; +- const char *pcre_err_ptr; +- int pcre_err_offset; +- int pcre_ovector[PCRE_OVECCOUNT]; ++ pcre2_code *pcre_re; ++ pcre2_match_data *pcre_md; ++ int pcre_err_ptr; ++ size_t pcre_err_offset; ++ size_t *pcre_ovector; + int pcre_rc; + + apr_hash_index_t *hi; +@@ -2662,9 +2660,9 @@ + const char *key; + int found = 0; + +- if((pcre_re = pcre_compile(name_match, 0, &pcre_err_ptr, &pcre_err_offset, NULL)) == NULL) ++ if((pcre_re = pcre2_compile((PCRE2_SPTR)name_match, PCRE2_ZERO_TERMINATED, 0, &pcre_err_ptr, &pcre_err_offset, NULL)) == NULL) + { +- err_msg ("pcre_compile failed on %s\n", name_match); ++ err_msg ("pcre2_compile failed on %s\n", name_match); + exit (1); + } + +@@ -2676,6 +2674,8 @@ + exit(EXIT_FAILURE); + } + ++ pcre_md = pcre2_match_data_create(PCRE_OVECCOUNT, NULL); ++ + for(hi = apr_hash_first(p, metric_callbacks); + hi; + hi = apr_hash_next(hi)) +@@ -2683,17 +2683,17 @@ + Ganglia_metric_callback *cb; + + apr_hash_this(hi, (const void**)&key, NULL, &val); +- if((pcre_rc = pcre_exec(pcre_re, NULL, key, strlen(key), 0, 0, pcre_ovector, PCRE_OVECCOUNT)) < 1) ++ if((pcre_rc = pcre2_match(pcre_re, (PCRE2_SPTR)key, strlen(key), 0, 0, pcre_md, NULL)) < 1) + { + switch(pcre_rc) + { +- case PCRE_ERROR_NOMATCH: ++ case PCRE2_ERROR_NOMATCH: + break; + case 0: + /* output vector not big enough */ + default: + /* unexpected error */ +- err_msg ("unexpected pcre_exec error\n"); ++ err_msg ("unexpected pcre2_match error\n"); + exit (1); + } + } +@@ -2703,6 +2703,8 @@ + char *title_tmpl = cfg_getstr ( metric, "title"); + float value_threshold = cfg_getfloat( metric, "value_threshold"); + ++ pcre_ovector = pcre2_get_ovector_pointer(pcre_md); ++ + if(title_tmpl != NULL) + { + struct iovec *ptrs; +@@ -2772,6 +2774,8 @@ + if (!found) + err_msg("Unable to find any metric information for '%s'. Possible that a module has not been loaded.\n", name_match); + ++ pcre2_match_data_free(pcre_md); ++ pcre2_code_free(pcre_re); + } + else + #endif diff --git a/debian/patches/series b/debian/patches/series index eb6441a..cc1500c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ 1_fix-minor-spelling-errors.patch +pcre2.patch -- 2.43.0