Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-11204

remove_param() breaks double quote escaping

XMLWordPrintable

      This function was completely broken in ZBXNEXT-300 (or has never been working correctly):

      • if it was asked to remove the first parameter it copies the first character of the second without checking whether it is double quote or not;
      • inside quoted parameters it skips '\' preceding double quote.

      As a result, calculated item

      count(dummy.echo[{$ECHO}],10m,"{$MACRO:\"with , and } characters\"}")
      

      was simply counting values ignoring pattern.

      Debug log wasn't very helpful:

        4807:20160914:142725.827 In get_value_calculated() key:'dummy.echo.count' expression:'count(dummy.echo[{$ECHO}],10m,"{$MACRO:\"with , and } characters\"}")'
        4807:20160914:142725.828 In calcitem_parse_expression() expression:'count(dummy.echo[{$ECHO}],10m,"{$MACRO:\"with , and } characters\"}")'
        4807:20160914:142725.828 calcitem_parse_expression() functionid:1 function:'count(dummy.echo[{$ECHO}],10m,"{$MACRO:\"with , and } characters\"}")'
        4807:20160914:142725.828 calcitem_parse_expression() expression:'{1}'
        4807:20160914:142725.828 In substitute_simple_macros() data:'{1}'
        4807:20160914:142725.828 End substitute_simple_macros() data:'{1}'
        4807:20160914:142725.828 End of calcitem_parse_expression():SUCCEED
        4807:20160914:142725.828 In calcitem_evaluate_expression()
        4807:20160914:142725.828 calcitem_evaluate_expression() function:'lld macro test:dummy.echo[{$ECHO}].count(10m,"{$MACRO:"with , and } characters"}")'
        4807:20160914:142725.828 In evaluate_function() function:'lld macro test:dummy.echo[{$ECHO}].count(10m,"{$MACRO:"with , and } characters"}")'
        4807:20160914:142725.828 In evaluate_COUNT()
        4807:20160914:142725.829 In __get_function_parameter_uint31() parameters:'10m,"{$MACRO:"with , and } characters"}"' Nparam:1
        4807:20160914:142725.829 In substitute_simple_macros() data:'10m'
        4807:20160914:142725.829 __get_function_parameter_uint31() flag:0 value:600
        4807:20160914:142725.829 End of __get_function_parameter_uint31():SUCCEED
        4807:20160914:142725.829 In zbx_vc_get_value_range() itemid:23934 value_type:4 seconds:600 count:0 timestamp:1473852445
        4807:20160914:142725.829 End of zbx_vc_get_value_range():SUCCEED count:20 cached:1
        4807:20160914:142725.829 End of evaluate_COUNT():SUCCEED
        4807:20160914:142725.829 End of evaluate_function():SUCCEED value:'20'
        4807:20160914:142725.829 End of calcitem_evaluate_expression():SUCCEED
        4807:20160914:142725.829 In evaluate() expression:'20'
        4807:20160914:142725.829 End of evaluate() value:20.000000
        4807:20160914:142725.829 get_value_calculated() value:20.000000
        4807:20160914:142725.829 End of get_value_calculated():SUCCEED
      

            Unassigned Unassigned
            glebs.ivanovskis Glebs Ivanovskis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: