Simple script crashes Scilab in GUI mode
@mottelet)
Reported by Stéphane MOTTELET (test.sce (8 bytes, text/plain)
script crashing Scilab
BUG DESCRIPTION:
----------------
Under macOS, A single script (attached) crashes Scilab when it is executed from the command line or from Scinotes.
This bug has been signaled by a collegue. The kind of error "l=;" i.e. forgetting a rhs is quite common for beginners...
ERROR LOG:
----------
terminate called after throwing an instance of 'GiwsException::JniCallMethodException'
what(): Exception when calling Java method : String index out of range: -45
at java.lang.String.substring(String.java:1967)
at org.scilab.modules.console.SciOutputView.displayLineBuffer(Unknown Source)
at org.scilab.modules.console.SciOutputView.append(Unknown Source)
at org.scilab.modules.gui.bridge.console.SwingScilabConsole.display(Unknown Source)
at org.scilab.modules.gui.console.ScilabConsoleBridge.display(Unknown Source)
at org.scilab.modules.gui.bridge.ScilabBridge.display(Unknown Source)
at org.scilab.modules.gui.console.ScilabConsole.display(Unknown Source)
at org.scilab.modules.gui.bridge.CallScilabBridge.display(Unknown Source)
String index out of range: -45
HOW TO REPRODUCE THE BUG:
-------------------------
Execute the attached script
OTHER INFORMATION:
------------------
The "String index out of range" does not seem to occur under Linux and Windows. In fact the problem is due to the error message to be printed, which contains a \r\n.
The bug occurs since the following fix:
https://codereview.scilab.org/#/c/21166/
which is supposed to allow the processing of carriage returns "\r" to be the same on the Java console and in CLI mode.