Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Truffle] class_eval should allow negative line number #3683

Closed
bjfish opened this issue Feb 18, 2016 · 5 comments
Closed

[Truffle] class_eval should allow negative line number #3683

bjfish opened this issue Feb 18, 2016 · 5 comments
Milestone

Comments

@bjfish
Copy link
Contributor

bjfish commented Feb 18, 2016

Environment

Truffle

class First
end
First.class_eval("def hello; puts 'hello'; end", "test.rb", -10)
n = First.new
n.hello

Expected Behavior

$ruby ceval.rb 
hello

Found in tilt which is used sinatra for erb templating

Actual Behavior

$ruby ceval.rb 
ceval.rb:3:in `class_eval': internal implementation error - NegativeArraySizeException null org.jruby.truffle.core.module.ModuleNodes$ClassEvalNode.classEvalSource(ModuleNodes.java:673) (RubyTruffleError)
    from ceval.rb:3:in `<main>'
@bjfish bjfish added the truffle label Feb 18, 2016
@chrisseaton
Copy link
Contributor

Ha ha how did you find that one?

@chrisseaton chrisseaton added this to the truffle-dev milestone Feb 18, 2016
@bjfish
Copy link
Contributor Author

bjfish commented Feb 18, 2016

@chrisseaton I was trying the erb functionality in sinatra:
Rubygems require and gem methods appear to work pretty well when enabled. So, I could just run:

GEM_HOME=/path/to/gem/home gem install sinatra # using ruby 2
GEM_HOME=/path/to/gem/home ruby sinatra_app.rb # using truffle

@chrisseaton
Copy link
Contributor

What did you have to do to enable it? Remove our gem shim? What about the require shim that they need? How was that enabled?

@bjfish
Copy link
Contributor Author

bjfish commented Feb 18, 2016

@chrisseaton See this patch: https://gist.github.com/bjfish/840c11b171450642bdab

  • Uncommented the Kernel gem and require methods in rubygems.rb
  • Removed the existing Kernel gem shim
  • Modified the psych loading code because the caller changes
  • Create a io/console.rb file to shim when this is required by thor

With these changes, I think there is only one MRI test regression. It might regress the way we test activesupport though.

One issue I am seeing is that I have to pass -rubygems sometimes in the command line when I don't believe that should be necessary. I think this has something to do with the order the require methods are being loaded or possibly our Truffle require node method having priority.

@bjfish
Copy link
Contributor Author

bjfish commented Sep 15, 2016

This has been fixed for a while.

@bjfish bjfish closed this as completed Sep 15, 2016
@enebo enebo added this to the Non-Release milestone Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants