1. Why is 2.2 not affected? Which changes introduced the current behaviour?
2. Is there a workaround (putting function, macro producing -1 in parentheses?)?
3. As Glebs Ivanovskis pointed out above
is not necessarily an invalid expression. The problem is that the syntax of our expression language is not defined in a formal way thus the correctness of such expression is ambiguous. Since we do not have prefix
operator and since unary
groups operand on the right - one could potentially interpret this expression as
. The question is - how do we document the changes?
1. The current behavior was introduced with
ZBXNEXT-1782. Version 2.2 is not affected (probably), because "--+-+5" is treated as "-5" (see functions evaluate(), evaluate_simple() and compress_signs()).
2. Yes, put the macro or function in parentheses.
3. Expression "--1" can be considered either valid or invalid, depending on the expression syntax. We do not have a formal definition of the syntax, but the informal definition, as governed by Alexander Vladishev, is meant to disallow "--1" and "not not 1". Do you mean that we should document in upgrade notes that we allowed "--1" before, but not anymore? RESOLVED.
Sandis Neilands Thanks for your answers. CLOSED points 1 and 2.
As for point 3 - currently the associativity/grouping rules and limitations of unary operators are not documented.
Aleksandrs Saveljevs Documented at the following locations:
Will copy the first change to 3.0 and 3.2 if OK. RESOLVED.
Sandis Neilands CLOSED.
Aleksandrs Saveljevs Also copied to https://www.zabbix.com/documentation/3.0/manual/config/triggers/expression#operators and https://www.zabbix.com/documentation/3.2/manual/config/triggers/expression#operators . Now really CLOSED.