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

psych gem should be default gem #2531

Closed
mkristian opened this issue Jan 28, 2015 · 6 comments
Closed

psych gem should be default gem #2531

mkristian opened this issue Jan 28, 2015 · 6 comments
Assignees

Comments

@mkristian
Copy link
Member

there is this psych gem: https://github.com/tenderlove/psych/tree/jruby

  • since it is not a default gem rubygems loading will ALLWAYS load the psych files from lib/ruby/stdlib (unless there is something special for psych)
  • since I switched back to the old classloader parent first preference the snakeyaml.jar from the psych gem will be loaded into the JrubyClassloader but never be used since we bundle snakeyaml with jruby itself.

for me this psych should be an default gem to fix those two problems

@mkristian mkristian self-assigned this Jan 28, 2015
@mkristian mkristian added this to the 9.0.0.0.pre2 milestone Jan 28, 2015
@mkristian
Copy link
Member Author

this is kind of 'egg or hen' problem:

https://github.com/mkristian/psych/tree/jruby-build

can build the gem but needs a jruby WITHOUT builtin psych to run the tests ! this jruby with psych as
default needs the a gem from the above branch - started this with

https://github.com/jruby/jruby/tree/test-psych

@monkstone
Copy link
Contributor

Since recent builds jruby 9.0.0.0-SNAPSHOT (2.2.0p0) 2015-02-27 5166bff OpenJDK 64-Bit Server VM 25.31-b07 on 1.8.0_31-b13 +jit [linux-amd64]
I am getting NameError: uninitialized constant Psych::Parser, even though gem seems to be include in build, (when trying to run ruby-processing).

@mkristian
Copy link
Member Author

@monkstone could you tell me what exactly you are running. travis runs OK including psych tests.

@monkstone
Copy link
Contributor

test script:

require 'psych'

RP_CONFIG = Psych.load_file("/home/tux/.rp5rc")
p RP_CONFIG

where .rp5rc is

---
PROCESSING_ROOT: "/home/tux/processing-3.0a5"
JRUBY: true
X_OFF: 50
Y_OFF: 20

prints

{"PROCESSING_ROOT"=>"/home/tux/processing-3.0a5", "JRUBY"=>true, "X_OFF"=>50, "Y_OFF"=>20} 

with jruby-1.7.18
and following error with jruby-9000

NameError: uninitialized constant Psych::Parser
  const_missing at org/jruby/RubyModule.java:2937
         (root) at /home/tux/.gem/ruby/2.2.0/gems/psych-2.0.13/lib/psych/nodes/stream.rb:12
        require at org/jruby/RubyKernel.java:966
         (root) at /home/tux/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
        require at /home/tux/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
        require at org/jruby/RubyKernel.java:966
         (root) at /home/tux/.gem/ruby/2.2.0/gems/psych-2.0.13/lib/psych/nodes.rb:2
         (root) at /home/tux/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
        require at org/jruby/RubyKernel.java:966
        require at /home/tux/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
     __script__ at yaml_test.rb:1

Now that's interesting if I remove my installed version of psych, it then works OK.

SUMMARY

So jruby-1.7.18 can cope with an installed psych whereas jruby-9000 apparently not. Perhaps other people won't see this as they use rvm, whereas I prefer a common gem home, also I don't do rails or use bundler. However could be an edge case for someone else?
Update also get same behaviour with jruby-complete
jruby 9.0.0.0-SNAPSHOT (2.2.1) 2015-03-03 626d862 OpenJDK 64-Bit Server VM 25.31-b07 on 1.8.0_31-b13 +jit [linux-amd64] ie won't play nicely with an installed version of psych, remove it works OK.
@mkristian

@mkristian
Copy link
Member Author

sorry for the late reply:

psych has native extension and you are using mri gems with native extension with jruby.

default gems will be ignored if there is regular gem is installed, i.e. jruby-9k starts using your psych-2.0.13 gem which you installed with MRI and this one does not work with JRuby.

a common GEM_HOME is OK, but at least separate it between MRI and JRuby.

@mkristian mkristian modified the milestones: Invalid or Duplicate, 9.0.0.0.pre2 Apr 8, 2015
@mkristian
Copy link
Member Author

after a second thought - there is nothing we can do from the jruby side of things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants