Module: check_mk
Branch: master
Commit: 70fee228c4b8752398c4200cc0190d2f65d24475
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=70fee228c4b875…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Dec 7 14:37:00 2018 +0100
6964 FIX Fixed matching of literal strings when C++11 regex engine is used.
Livestatus and CMC can use one of two regex engines: Either then one from
the C++11 standard library or the one from the RE2 library. Normal builds
ship the latter, only a manually built Livestatus should ever use the
former. Nevertheless, both should work, but the C++11 variant had a quoting
bug, resulting in incorrect matching. This has been fixed.
Change-Id: Iaeb5db079c11db6f85ab22ee45c8dd4b2a8532a0
---
.werks/6964 | 14 ++++++++++++++
livestatus/src/RegExp.cc | 4 ++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/.werks/6964 b/.werks/6964
new file mode 100644
index 0000000..b8c1ebe
--- /dev/null
+++ b/.werks/6964
@@ -0,0 +1,14 @@
+Title: Fixed matching of literal strings when C++11 regex engine is used.
+Level: 2
+Component: livestatus
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1544189517
+Class: fix
+
+Livestatus and CMC can use one of two regex engines: Either then one from
+the C++11 standard library or the one from the RE2 library. Normal builds
+ship the latter, only a manually built Livestatus should ever use the
+former. Nevertheless, both should work, but the C++11 variant had a quoting
+bug, resulting in incorrect matching. This has been fixed.
diff --git a/livestatus/src/RegExp.cc b/livestatus/src/RegExp.cc
index eff949d..8e60074 100644
--- a/livestatus/src/RegExp.cc
+++ b/livestatus/src/RegExp.cc
@@ -79,8 +79,8 @@ public:
Impl(const std::string &str, Case c, Syntax s)
: _regex(s == Syntax::literal
? std::regex_replace(
- str, std::regex(R"([.^$|()\[\]{}*+?\\])"),
- R"(\&)", std::regex_constants::format_sed)
+ str, std::regex(R"([.^$|()\[\]{}*+?\\])"), R"(\\&)",
+ std::regex_constants::format_sed)
: str,
c == Case::respect
? std::regex::extended
Module: check_mk
Branch: master
Commit: 90431c0644be64fee026079acdbab4546b661025
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=90431c0644be64…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Fri Dec 7 09:34:03 2018 +0100
checktestlib: allow 'item not found'-case
Change-Id: I16c24ba1437829b8d1985a1a43bf63ef9d481344
---
tests/unit/checks/checktestlib.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/unit/checks/checktestlib.py b/tests/unit/checks/checktestlib.py
index e22049c..36282fd 100644
--- a/tests/unit/checks/checktestlib.py
+++ b/tests/unit/checks/checktestlib.py
@@ -173,11 +173,13 @@ class CheckResult(object):
If the result is already a plain check result in its tuple representation,
we initialize a list of length 1.
"""
+ self.subresults = []
+ if result is None:
+ return
if isinstance(result, CheckResult):
self.__dict__ = result.__dict__
return
- self.subresults = []
if isinstance(result, types.GeneratorType):
for subresult in result:
self.subresults.append(BasicCheckResult(*subresult))