[ZBX-9598] XML import containing 0x1B character (ASCII escape character) is failed Created: 2015 May 28 Updated: 2019 Dec 10 |
|
Status: | Reopened |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | API (A) |
Affects Version/s: | 2.4.5 |
Fix Version/s: | None |
Type: | Incident report | Priority: | Trivial |
Reporter: | Oleksii Zagorskyi | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 1 |
Labels: | encoding, import, xml | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Issue Links: |
|
Description |
http://en.wikipedia.org/wiki/Escape_character The character is here: (copy-paste works for me) When I try to import such XML - it ends with XML file contains fatal error 9:PCDATA invalid Char value 27 [ Line: 417 | Column: 17 ] [conf.import.php:190 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CXmlImportReader->read() in /zab/www-dev/2.4/include/classes/import/CConfigurationImport.php:132] It's possible to insert this character manually, into host name for example, using zabbix frontend (I used Opera12 browser). I discovered this issue for a "software_full" inventory field which was populated automatically by server. So, it may be stored, exported to XML but cannot be imported later. |
Comments |
Comment by Oleksii Zagorskyi [ 2015 May 28 ] |
Not sure how it should be fixed - allow import, disallow export or disallow storing the character. Not very related, but we have such page, just in case - https://www.zabbix.com/documentation/2.4/manual/appendix/items/encoding_of_values |
Comment by Ivo Kurzemnieks [ 2015 Jun 11 ] |
(1) No translation string changes. sasha CLOSED |
Comment by Ivo Kurzemnieks [ 2015 Jun 11 ] |
RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-9598 |
Comment by Ivo Kurzemnieks [ 2015 Jun 11 ] |
The problem is that XML format forbids ASCII control characters and when exported it becomes invalid. We decided to make a special conversion for those non-printable characters. For example the character will be converted to hex-like string \x1b. If some field already contains a string with \x, it will be esacped with a preceding backslash. The convertion will work both ways. Meaning importing data back, will convert hex-like strings to ASCII control characters and remove the extra backslash. This will be done in 2.5.0 (trunk). Importing an older XML version (for example 2.4), chain converter will transform the normal string \x to expected format for 3.0 importer. |
Comment by richlv [ 2015 Jun 16 ] |
(2) let's document this. our xml docs are sad, but let's at least mention this detail |
Comment by Alexander Vladishev [ 2015 Jul 01 ] |
(3) It works incorrectly with backslashes before a control char. For example: abc\ => controlCharsToHex() => abc\\x1b => hexToAscii() => abc\x1b iivs RESOLVED in r54306 |
Comment by Alexei Vladishev [ 2016 Mar 07 ] |
This case is extremely rare. I think that the best solution is to validate export and fail if such prohibited characters exist. |
Comment by richlv [ 2016 Mar 07 ] |
so if a host has such characters auto-populated in the inventory, it would be impossible to export it ? |