From 5e19d1d044704505344f67b021eb6f1baddfffe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 5 Feb 2019 07:31:24 +0200 Subject: [PATCH] MXS-2315: Use BRE with std::regex The default ECMAScript syntax appears to be broken on CentOS 7 which effectively prevents its use in most cases. A more reliable alternative would be to use the bundled PCRE2 library but the basic POSIX regular expressions seem to work. --- server/modules/monitor/csmon/csmon.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/modules/monitor/csmon/csmon.cc b/server/modules/monitor/csmon/csmon.cc index 4e369d8df..3962b9860 100644 --- a/server/modules/monitor/csmon/csmon.cc +++ b/server/modules/monitor/csmon/csmon.cc @@ -56,8 +56,10 @@ static std::string do_query(MXS_MONITORED_SERVER* srv, const char* query) // Returns a numeric version similar to mysql_get_server_version int get_cs_version(MXS_MONITORED_SERVER* srv) { + // GCC 4.8 appears to have a broken std::regex_constants::ECMAScript that doesn't support brackets + std::regex re("Columnstore \\([0-9]*\\)[.]\\([0-9]*\\)[.]\\([0-9]*\\)-[0-9]*", + std::regex_constants::basic); std::string result = do_query(srv, "SELECT @@version_comment"); - std::regex re("Columnstore ([0-9]*)[.]([0-9]*)[.]([0-9]*)-[0-9]*"); std::smatch match; int rval = 0;