From 431932d8d63a0f85694c1ec5ec43435a048ffff7 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Tue, 9 Oct 2012 15:24:04 +0200
Subject: bugfix: in (non)equal comparisons the position of arrays influenced
result
This behaviour is OK for "contains"-type of comparisons (which have quite
different semantics), but not for == and <>, which shall be commutative.
This has been fixed now, so there is no difference any longer if the
constant string array is the left or right hand operand. We solved this
via the optimizer, as it keeps the actual script execution code small.
---
ChangeLog | 6 ++++++
grammar/rainerscript.c | 17 ++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index e9bde040..309c4a02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
---------------------------------------------------------------------------
Version 7.1.9 [beta] 2012-10-??
- bugfix: comments inside objects (e.g. action()) were not properly handled
+- bugfix: in (non)equa comparisons the position of arrays influenced result
+ This behaviour is OK for "contains"-type of comparisons (which have quite
+ different semantics), but not for == and <>, which shall be commutative.
+ This has been fixed now, so there is no difference any longer if the
+ constant string array is the left or right hand operand. We solved this
+ via the optimizer, as it keeps the actual script execution code small.
---------------------------------------------------------------------------
Version 7.1.8 [beta] 2012-10-02
- bugfix: ruleset(){} directive errornously changed default ruleset
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index 7e75326c..ad6a32e8 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -1173,6 +1173,8 @@ evalVar(struct cnfvar *var, void *usrptr, struct var *ret)
* that one one comparison is true, the whole construct is true.
* TODO: we can obviously optimize this process. One idea is to
* compile a regex, which should work faster than serial comparison.
+ * Note: compiling a regex does NOT work at all. I experimented with that
+ * and it was generally 5 to 10 times SLOWER than what we do here...
*/
static int
evalStrArrayCmp(es_str_t *estr_l, struct cnfarray* ar, int cmpop)
@@ -1756,7 +1758,6 @@ cnfexprPrint(struct cnfexpr *expr, int indent)
struct cnffunc *func;
int i;
- dbgprintf("expr %p, indent %d, type '%c'\n", expr, indent, expr->nodetype);
switch(expr->nodetype) {
case CMP_EQ:
cnfexprPrint(expr->l, indent+1);
@@ -2322,6 +2323,7 @@ void
cnfexprOptimize(struct cnfexpr *expr)
{
long long ln, rn;
+ struct cnfexpr *exprswap;
dbgprintf("optimize expr %p, type '%c'(%u)\n", expr, expr->nodetype, expr->nodetype);
switch(expr->nodetype) {
@@ -2358,6 +2360,19 @@ cnfexprOptimize(struct cnfexpr *expr)
((struct cnfnumval*)expr)->val = ln % rn;
}
break;
+ case CMP_NE:
+ case CMP_EQ:
+ if(expr->l->nodetype == 'A') {
+ if(expr->r->nodetype == 'A') {
+ parser_errmsg("warning: '==' or '<>' "
+ "comparison of two constant string "
+ "arrays makes no sense");
+ } else { /* swap for simpler execution step */
+ exprswap = expr->l;
+ expr->l = expr->r;
+ expr->r = exprswap;
+ }
+ }
default:/* nodetype we cannot optimize */
break;
}
--
cgit v1.2.3
From 1cddc1c360f3af164735fab1dcee4ac56d580084 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Tue, 9 Oct 2012 15:38:37 +0200
Subject: prepare for 7.1.9 release
---
ChangeLog | 4 ++--
configure.ac | 2 +-
doc/manual.html | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 309c4a02..2fbdf8db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
---------------------------------------------------------------------------
-Version 7.1.9 [beta] 2012-10-??
+Version 7.1.9 [beta] 2012-10-09
- bugfix: comments inside objects (e.g. action()) were not properly handled
-- bugfix: in (non)equa comparisons the position of arrays influenced result
+- bugfix: in (non)equal comparisons the position of arrays influenced result
This behaviour is OK for "contains"-type of comparisons (which have quite
different semantics), but not for == and <>, which shall be commutative.
This has been fixed now, so there is no difference any longer if the
diff --git a/configure.ac b/configure.ac
index f7d2bdd4..10a7f3ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT([rsyslog],[7.1.8],[rsyslog@lists.adiscon.com])
+AC_INIT([rsyslog],[7.1.9],[rsyslog@lists.adiscon.com])
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
diff --git a/doc/manual.html b/doc/manual.html
index 60704aff..504c65f2 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -19,7 +19,7 @@ rsyslog support available directly from the source!
Please visit the rsyslog sponsor's page
to honor the project sponsors or become one yourself! We are very grateful for any help towards the
project goals.
-This documentation is for version 7.1.8 (beta branch) of rsyslog.
+
This documentation is for version 7.1.9 (beta branch) of rsyslog.
Visit the rsyslog status page
to obtain current version information and project status.
If you like rsyslog, you might
--
cgit v1.2.3
From 573a2163dd7314922760f2d9140dfb0b083909d9 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Tue, 9 Oct 2012 18:59:05 +0200
Subject: cosmetic cleanup
---
tools/logctl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/logctl.c b/tools/logctl.c
index df332bc2..1ab8ead0 100644
--- a/tools/logctl.c
+++ b/tools/logctl.c
@@ -143,7 +143,6 @@ struct ofields* get_data(struct results *res)
struct ofields *fields;
const char *msg;
const char *prog;
- const char *level;
const char *syslog_tag;
gint64 date_r;
bson_cursor *c;
@@ -263,7 +262,7 @@ struct select_doc* create_select()
struct query_doc* create_query(struct queryopt *opt)
{
struct query_doc *qu_doc;
- bson *query_what, *order_what, *order_how, *msg_what, *date_what;
+ bson *query_what, *order_what, *msg_what, *date_what;
struct tm tm;
time_t t;
gint64 ts;
@@ -417,7 +416,6 @@ int main (int argc, char *argv[])
struct queryopt opt;
struct ofields *fields;
- struct bson_doc *doc;
struct select_doc *s_doc;
struct query_doc *qu_doc;
struct db_connect *db_conn;
--
cgit v1.2.3