From f3ad2002195f76d290ee1c4b83899223701faba3 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sun, 23 Nov 2014 14:41:45 +0100 Subject: [PATCH] patches: Added bts770694_loglevel. Upstream fix to correct logging behavior when using an invalid log level. Thanks to Marc Fournier for reporting this. Closes: #770694 --- debian/changelog | 3 ++ debian/patches/00list | 1 + debian/patches/bts770694_loglevel.dpatch | 45 ++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100755 debian/patches/bts770694_loglevel.dpatch diff --git a/debian/changelog b/debian/changelog index fcc68eb..5af6779 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,6 +21,9 @@ collectd (5.4.1-6) UNRELEASED; urgency=medium thanks to Marc Fournier for reporting this (Closes: #770690). - Added bts770693_timestamps: upstream fix for handling internal timestamps; thanks to Marc Fournier for reporting this (Closes: #770693) + - Added bts770694_loglevel: upstream fix to correct logging behavior when + using an invalid log level; thanks to Marc Fournier for reporting this + (Closes: #770694). -- Sebastian Harl Sun, 23 Nov 2014 13:04:03 +0100 diff --git a/debian/patches/00list b/debian/patches/00list index 92316ee..61ca4d3 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -10,3 +10,4 @@ bts770683_curl_init.dpatch bts750440_config_segfault.dpatch bts770688_snmp_memleak.dpatch bts770690_java_jni_thread_detach.dpatch +bts770694_loglevel.dpatch diff --git a/debian/patches/bts770694_loglevel.dpatch b/debian/patches/bts770694_loglevel.dpatch new file mode 100755 index 0000000..9fb659e --- /dev/null +++ b/debian/patches/bts770694_loglevel.dpatch @@ -0,0 +1,45 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## bts770694_loglevel.dpatch +## +## DP: Make sure not to disable logging on invalid log levels. +## DP: +## DP: Debug logging is not compiled into the Debian packages. Make sure to +## DP: fall back to INFO and report and error rather than silently dropping +## DP: all further log messages. +## DP: +## DP: Upstream bug report: +## DP: https://github.com/collectd/collectd/issues/636 + +@DPATCH@ + +diff a/src/logfile.c b/src/logfile.c +--- a/src/logfile.c ++++ b/src/logfile.c +@@ -54,7 +54,11 @@ static int logfile_config (const char *key, const char *value) + { + if (0 == strcasecmp (key, "LogLevel")) { + log_level = parse_log_severity(value); +- if (log_level == -1) return 1; /* to keep previous behaviour */ ++ if (log_level < 0) { ++ log_level = LOG_INFO; ++ ERROR ("logfile: invalid loglevel [%s] defaulting to 'info'", value); ++ return (1); ++ } + } + else if (0 == strcasecmp (key, "File")) { + sfree (log_file); +diff a/src/syslog.c b/src/syslog.c +--- a/src/syslog.c ++++ b/src/syslog.c +@@ -48,7 +48,11 @@ static int sl_config (const char *key, const char *value) + { + log_level = parse_log_severity (value); + if (log_level < 0) ++ { ++ log_level = LOG_INFO; ++ ERROR ("syslog: invalid loglevel [%s] defaulting to 'info'", value); + return (1); ++ } + } + else if (strcasecmp (key, "NotifyLevel") == 0) + { -- 2.30.2