[ZBX-3940] newlines stored differently depending on client operating system Created: 2011 Jul 11 Updated: 2019 Dec 10 |
|
Status: | Open |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Frontend (F) |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Incident report | Priority: | Trivial |
Reporter: | richlv | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 0 |
Labels: | eol, trivial, validation | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: |
![]() |
Description |
attempt to save map label with some newlines in it and ~ 255 characters in length. frontend complains that it exceeds 255, but it seems that from windows systems newlines are attempted to be stored as \r\n, from non-windows - just \n. they should be just \n always. additionally, error message is enclosed both in double and single quotes - that's a bit excessive |
Comments |
Comment by Oleksii Zagorskyi [ 2011 Jul 11 ] |
I faced with the "similar" stuff some time ago (for eventlog), and because i'm interesting now. Label was edited (EOL added-deleted and map is saved) in the Opera under Windows and Iceweasel under Debian several times. So, i can't confirm difference between windows and non-windows OS. It seems EOL always stored with the \r\n. Label was (EOL preserved): "first_line Used trunk GUI 1.9.5 I don't know is useful for you all this debugging or not |
Comment by richlv [ 2011 Jul 13 ] |
hmm. indeed, looks like from linux it saves '0D' (non-converted \r), followed by converted \n ... |
Comment by Aleksandrs Saveljevs [ 2011 Jul 15 ] |
A related problem that can be dealt with in this issue. Current GUI code has interesting line feed and carriage reload sequences: $ grepphp '\\n\\r' ./frontends/php/sysmap.php:228: throw new Exception(S_MAP_SAVE_OPERATION_FAILED."\n\r"); ./frontends/php/sysmap.php:232: $msg = $e->getMessage()."\n\r"; ./frontends/php/acknow.php:86: $_REQUEST['message'] .= ($_REQUEST['message'] == '' ? '' : "\n\r") . S_SYS_BULK_ACKNOWLEDGE; These should be changed to either "\r\n" or "\n". asaveljevs Still the case in 3.0.0beta1 (trunk) r58018: $ mgrep php '\\n\\r' ./frontends/php/include/classes/import/converters/C10ImportConverter.php: $host['inventory'][$key] .= "\r\n\r\n".$value; ./frontends/php/include/classes/validators/CIPRangeValidator.php: $range = trim($range, " \t\n\r"); ./frontends/php/tests/unit/include/classes/parsers/CTriggerExpressionTest.php: ["{host:key.last(1)}\r\n\r\n+\r\n\r\n1", null, true], ./frontends/php/tests/unit/include/classes/import/converters/C10ImportConverterTest.php: 'notes' => 'notes'."\r\n\r\n".'device notes', ./frontends/php/tests/unit/include/classes/validators/CIPRangeValidatorTest.php: [[], "192.168.1.1-2\t\n\r,\t\n\r192.168.1.2-3"], ./frontends/php/tests/unit/include/classes/validators/CIPRangeValidatorTest.php: "192.168.1.1-2\t\n\r, 192.168.1.2-3", ./frontends/php/sysmap.php: throw new Exception(_('Access denied!')."\n\r"); ./frontends/php/sysmap.php: throw new Exception(_('Map update failed.')."\n\r"); ./frontends/php/sysmap.php: echo 'alert('.zbx_jsvalue(implode("\n\r", $msg)).');'; zalex_ua Yeah, I recently worked for a task where I had to convert data in mysqldump file.
asaveljevs Will be dealt with in (155) of |
Comment by Oleksii Zagorskyi [ 2015 Sep 01 ] |
Had to return to this issue once more. When I edit a row (actions.def_longdata) using an Edit link of a row (opening it's page where I press Go after editing) - then all existing and added EOLs added as CRLF. Then if open the edited action in zabbix frontend (2.4.5) and click Update (without any edits!) - those LFs again stored as CRLFs. funny ... p.s. to check EOL type stored in database I used mysql> select def_longdata from actions where actionid=3 into outfile '/tmp/test'; and viewed the test file in a hex view. |