summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--grammar/rainerscript.c17
-rw-r--r--tools/logctl.c4
3 files changed, 24 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 224afae5..0157652f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,8 +10,14 @@ Version 7.3.0 [devel] 2012-10-09
This was achieved by somewhat reducing the robustness of the zip archive.
This is controlled by the new action parameter "VeryReliableZip".
---------------------------------------------------------------------------
-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)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.
---------------------------------------------------------------------------
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;
}
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;