[ZBX-8943] Scripts in the menu can be sorted incorrectly Created: 2014 Oct 23  Updated: 2017 May 30  Resolved: 2015 Jan 10

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.2.6, 2.4.1
Fix Version/s: 2.5.0

Type: Incident report Priority: Trivial
Reporter: richlv Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: usability
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File scripts.png    

 Description   

It is moved from ZBXNEXT-1786 (44)

have scripts like these :
b/a
z
\a/c

sorting in the popup goes b/z/a

sorting on each level should happen on sanitised values (after the escaping)



 Comments   
Comment by Arvids Godjuks (Inactive) [ 2014 Oct 24 ]

Fixed in dev branch svn://svn.zabbix.com/branches/dev/ZBX-8943

Comment by Arvids Godjuks (Inactive) [ 2014 Oct 24 ]

(1) No translation changes

iivs CLOSED.

Comment by Ivo Kurzemnieks [ 2014 Oct 27 ]

(2)

  1. Error in script edit form:
        Undefined index: name [scripts.php:70 → CFrontendApiWrapper->get() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CScript->get() in C:\Development\ZBX-8943-test\frontends\php\include\classes\api\services\CScript.php:163]
  2. Slash escaping should be done when sorting by name, but API still should return non-escaped names. Slash escaping should be done on client side.

arvids.godjuks RESOLVED in r50206.
Sort is happening at the PHP level, so I moved the backslash filtering to the same place where the sorting is done.

iivs CLOSED.

Comment by Ivo Kurzemnieks [ 2014 Oct 27 ]

(3) No changes in monitoring section. Sorting still boges b->z->a
arvids.godjuks RESOLVED in r50206 - added backslash trimming at the start and end of the string

iivs Tried various strings with slashes and got unexpected results. All slashes at the beginning and end are esaped. A backslash means that the next following symbol should be treated like normal symbol. It means if I enter name "\\a\b" the result should be "\ab" not "ab". If I enter name with "\/" the name is "/", not empty string which breaks the menu popup. Similarly with "d
", "d\\\", both return same name "d", which is not correct.

REOPENED.

arvids.godjuks RESOLVED in r50556

sasha Backslashes are removed not in all cases, for example:

\ac\/\a => ac/\a

REOPENED

arvids.godjuks RESOLVED in r50597

iivs Coding style:
func.inc.php splitPath()

  • Avoid using such assignments $escapeCharacters = $pathItemString = '';
  • Comments are not following guidelines - sentences must end with a dot.
  • Integers must not use strict comparison.

REOPENED.

arvids.godjuks RESOLVED in r50918

iivs I fixed coding style in several other lines of code. Please see my changes in r50933

arvids.godjuks CLOSED

Comment by Ivo Kurzemnieks [ 2014 Nov 04 ]

(4) Slash escaping and sorting is not covered in maps.

arvids.godjuks RESOLVED in r50558

iivs CLOSED.

Comment by Alexander Vladishev [ 2014 Nov 12 ]

(5) backslashes should not be removed by API when creating or updating a script

arvids.godjuks RESOLVED in r50597

sasha CLOSED

Comment by Ivo Kurzemnieks [ 2014 Dec 01 ]

TESTED,
but don't forget to close (3).

Comment by Arvids Godjuks (Inactive) [ 2014 Dec 01 ]

Merged to 2.5.0 (trunk) in r50937

Comment by Oleg Egorov (Inactive) [ 2015 Jan 09 ]

(6) Administration->Scripts
Name: <Sub-menu/Sub-menu.../>Script

Result:

sasha It's broken under ZBXNEXT-2073 in version 2.3.0. Moved to ZBX-9203.

CLOSED

Generated at Fri Apr 26 01:38:44 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.