Bug 890069

Summary: scala REPL crashes on println("Hello World!")
Product: [Fedora] Fedora Reporter: Wade Dare <tony.dare>
Component: scalaAssignee: Geoff Reedy <geoff+fedora>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 19CC: geoff+fedora, jochen, mgoldman, pahan, shawn.meier
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-13 15:19:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Wade Dare 2012-12-24 22:10:56 UTC
Description of problem:
attempting to println() any string ending in an exclamation point crashes the REPL

Version-Release number of selected component (if applicable):
2.9.2


How reproducible:
Every time attempted

Steps to Reproduce:
1. start scala interpreter
2. type in -> println("Hello World!")
3. press <enter>
  
Actual results:
[localhost:>]scala
Welcome to Scala version 2.9.2-unknown-unknown (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_10).
Type in expressions to have them evaluated.
Type :help for more information.

scala> println("Hello World!")
java.lang.IllegalArgumentException: !"): event not found
at jline.console.ConsoleReader.expandEvents(ConsoleReader.java:426)
at jline.console.ConsoleReader.finishBuffer(ConsoleReader.java:311)
at jline.console.ConsoleReader.readLine(ConsoleReader.java:1216)
at jline.console.ConsoleReader.readLine(ConsoleReader.java:1051)
at scala.tools.nsc.interpreter.JLineReader.readOneLine(JLineReader.scala:76)
at scala.tools.nsc.interpreter.InteractiveReader$class.readLine(InteractiveReader.scala:44)
at scala.tools.nsc.interpreter.JLineReader.readLine(JLineReader.scala:19)
at scala.tools.nsc.interpreter.ILoop.readOneLine$1(ILoop.scala:533)
at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:550)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:67)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:80)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
That entry seems to have slain the compiler. Shall I replay
your session? I can re-run each line except the last one.
[y/n]



Expected results:
Hello World!

Additional info:
[hostname>]$ 
This, however will print normally:
scala> println("I have 9! kinds! of crazy going on.")
I have 9! kinds! of crazy going on.

This will not:
scala> println("I have 9! kinds! of crazy going on!")

So it seems an exclamation point at the end of the string crashes the REPL. Occurs whether the jvm scala is using is from oracle's jdk 1.7 or openjdk 1.7

This bug was out of scope for the scala people(this bug was posted there first).  They say that a different version of Jlines is being used for this fedora distribution than what they use for scala 2.9.2, if that's any help.

All other functionality seems to be intact as I go through the "Programming in Scala" examples.

Comment 1 Shawn Meier 2013-01-29 22:17:33 UTC
I can confirm that this bug is a problem.  It also shows up when you are using the ! logical operator or the != operator.  For example !true will cause a problem.  One possible work around for the logical operator is to put a space between the ! and the thing you are working with, for example ! true works.  However the only workaround I have found for != is to replace a != b with ! (a==b).

It was suggested to me that other distros use a modified jline package whereas the fedora one does not.  If I learn anything more I will try to post it here.

Comment 2 Shawn Meier 2013-01-29 23:28:38 UTC
One possible work around that I have found is to make scala unable to find the jline2.jar which makes it just fall back to what it calls the "simple reader".  You can do this by running `mv /usr/share/java/jline2.jar /usr/share/java/jline2.jar.old` as root.  However I have no idea what else this breaks but it does make the command !true and println("hello world!") work.

Comment 3 Jochen Schmitt 2013-01-30 17:35:13 UTC
Becouse the scala package in fedora use the system jline2 package
in opposite of the upstream distribution I have reassign this bug to jline2.

Comment 4 Shawn Meier 2013-01-30 19:54:29 UTC
It seems like the original jline package is still installed, is there an easy way to just point scala toward that instead of jline2?

Comment 5 Jochen Schmitt 2013-01-30 23:02:45 UTC
I have tried to change all occurance of jline.jar in jline2.jar in the
whole source tree of scala. But unfortunately after a build and remove of the
jline package the complaint issue still exists.

Comment 6 Shawn Meier 2013-02-01 18:34:37 UTC
I believe this is set in the source code and defined via class paths.  For example import org.blah.jline2 instead of import org.blah.jline.  Unfortunately my java fu isn't good enough to know if I can fix this without recompiling.

Comment 7 Fedora End Of Life 2013-07-03 22:32:22 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Fedora End Of Life 2013-08-01 00:29:31 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 9 Jochen Schmitt 2013-10-12 18:39:42 UTC




Issue stell exist with scala-2.10.3 and jline2-2.10 on F-19.

Comment 10 Jochen Schmitt 2013-10-13 15:19:10 UTC
I have found a fix in scala-2.10.3. the soultion is to call
consoleReader.setExpandEvents(false) before you call consoleRealder.readLine.
So the issue should fixed in scala-2.10.3-2.