[ZBX-9458] discovery macros are not quoted correctly in calculated item expressions Created: 2015 Apr 07 Updated: 2019 Mar 11 Resolved: 2016 Jan 19 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Server (S) |
Affects Version/s: | 2.4.4 |
Fix Version/s: | 2.0.17rc1, 2.2.12rc1, 2.4.8rc1, 3.0.0alpha5 |
Type: | Incident report | Priority: | Minor |
Reporter: | Aleksandrs Saveljevs | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 1 |
Labels: | calculateditems, escaping, lld, macros, quoting | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: | some_tests_after_fix.txt | ||||||||||||||||
Issue Links: |
|
Description |
Suppose we have the following item prototype: echo[{#VALUE}] If the value of {#VALUE} macro is "quoted" (quotes are part of the value), then in the discovered item key the expanded macro is quoted correctly: echo["\"quoted\""] However, suppose we have a calculated item prototype with the following expression: strlen(echo[{#VALUE}]) In this case, expression of the discovered calculated item will be the following, which is not correct: strlen(echo["quoted"]) |
Comments |
Comment by Jason McIntosh [ 2015 Apr 23 ] |
Affects 2.2.3 as well as 2.4 as I hit this myself with JDBC pool names in tomcat. |
Comment by Andris Zeila [ 2015 Oct 27 ] |
Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-9458 |
Comment by Sandis Neilands (Inactive) [ 2015 Dec 10 ] |
(1) Added few comments and minor changes in r57130 (RESOLVED). Please review. wiper Thanks, CLOSED |
Comment by Sandis Neilands (Inactive) [ 2015 Dec 10 ] |
(2) Having no complete specification of our expression language it is quite difficult to tell which cases are correct and which are not, especially regarding unquoted strings. Please take a look at some_tests_after_fix.txt. Maybe you can find some cases that you think are not correct. In any case it is strongly recommended that the users always quote item keys in functions (for calculated items). wiper While looking at tests found a bug in function parameter quoting.The quoting was enforced if the parameter was originally quoted or the new value contained ',' and ')' characters. However it should be also quoted if it starts with ' ' or '"' characters. RESOLVED in r57202 sandis.neilands CLOSED with minor edits of comments in r57220. |
Comment by Sandis Neilands (Inactive) [ 2015 Dec 10 ] |
(3) Considering that currently this correction is targeted to minor releases as far back as 2.0 and it contains "interface" changes I would like our support team to look at it and comment on the acceptable risks. These changes definitely break backwards compatibility of how calculated item formulas are created from discovery item prototypes.
Few questions that might be relevant... wiper As we don't know what lld data could be processed - we can't tell if the generated item would be ok or not. Regarding any compatibility issues - we will document it in upgrade notes. I don't think we should provide any configurable option to have it working incorrectly. sandis.neilands OK, CLOSED. |
Comment by Andris Zeila [ 2015 Dec 17 ] |
Released in:
|
Comment by Andris Zeila [ 2015 Dec 17 ] |
Documentation:
sasha It must be rephrased. I think that the word "illegal" is not good here. The double quote (") also must be in this list. REOPENED wiper double quote and space belong to another list, RESOLVED sasha CLOSED |