Code

patches: Added bts770694_loglevel.
authorSebastian Harl <sh@tokkee.org>
Sun, 23 Nov 2014 13:41:45 +0000 (14:41 +0100)
committerSebastian Harl <sh@tokkee.org>
Sun, 23 Nov 2014 13:41:45 +0000 (14:41 +0100)
Upstream fix to correct logging behavior when using an invalid log level.
Thanks to Marc Fournier for reporting this.

Closes: #770694
debian/changelog
debian/patches/00list
debian/patches/bts770694_loglevel.dpatch [new file with mode: 0755]

index fcc68eb6fa95dc571a090815f453ff58fbadac61..5af677953280a0787cdbbd7e3945573f78fce93f 100644 (file)
@@ -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 <tokkee@debian.org>  Sun, 23 Nov 2014 13:04:03 +0100
 
index 92316ee5157aa87bf8352773c909f7388ff893de..61ca4d3aecc1c2f2c1b96a132d0694a10ab1d31d 100644 (file)
@@ -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 (executable)
index 0000000..9fb659e
--- /dev/null
@@ -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)
+       {