Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.6, JRuby 1.6.7
-
Fix Version/s: JRuby 1.6.8, JRuby 1.7.0.pre1
-
Component/s: Core Classes/Modules
-
Labels:None
-
Number of attachments :
Description
I had an issue recently which forced me to revert to back to jruby-1.6.5.1 from jruby-1.6.7
jruby-1.6.7 :001 > s = "{ :summary =>'some text\n\r\n\nPlease be sure to include your:\n\r\n \r\nfull name \r\n \r\nemail address \r', :keywords=>'premium services'}"
=> "{ :summary =>'some text\n\r\n\nPlease be sure to include your:\n\r\n \r\nfull name \r\n \r\nemail address \r', :keywords=>'premium services'}"
jruby-1.6.7 :002 > eval(s)
SyntaxError: (eval):9: syntax error, unexpected tIDENTIFIER
', :keywords=>'premium services'}
^
from org/jruby/RubyKernel.java:1088:in `eval'
from (irb):2:in `evaluate'
from org/jruby/RubyKernel.java:1088:in `eval'
from org/jruby/RubyKernel.java:1410:in `loop'
from org/jruby/RubyKernel.java:1197:in `catch'
from org/jruby/RubyKernel.java:1197:in `catch'
from /home/ubuntu/.rvm/rubies/jruby-1.6.7/bin/jirb:17:in `(root)'
The above behaviour also occurs in 1.6.6
In jruby-1.6.5.1 all is well:
jruby-1.6.5.1 :001 > s = "{ :summary =>'some text\n\r\n\nPlease be sure to include your:\n\r\n \r\nfull name \r\n \r\nemail address \r', :keywords=>'premium services'}"
=> "{ :summary =>'some text\n\r\n\nPlease be sure to include your:\n\r\n \r\nfull name \r\n \r\nemail address \r', :keywords=>'premium services'}"
jruby-1.6.5.1 :002 > eval(s)
=> {:summary=>"some text\n\n\nPlease be sure to include your:\n\n \nfull name \n \nemail address \n", :keywords=>"premium services"}
Issue Links
- relates to
-
JRUBY-6344
Embedded \r should not be treated as end of comment line
-
It is not eval that is broken. (I changed the summary to more accurately describe the problem.) What is broken is how '\r' is treated. This is due to the work I did for
JRUBY-6344.As a workaround, please avoid a string-ending '\r'.
irb(main):002:0> RUBY_DESCRIPTION => "jruby 1.6.7 (ruby-1.8.7-p357) (2012-03-18 9002961) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]" irb(main):003:0> s = "{ :summary =>'some text\n\r\n\nPlease be sure to include your:\n\r\n \r\nfull name \r\n \r\nemail address \r\n', :keywords=>'premium services'}" => "{ :summary =>'some text\n\r\n\nPlease be sure to include your:\n\r\n \r\nfull name \r\n \r\nemail address \r\n', :keywords=>'premium services'}" irb(main):004:0> eval s => {:summary=>"some text\n\n\nPlease be sure to include your:\n\n \nfull name \n \nemail address \n", :keywords=>"premium services"}