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

Rubygems broken due to psych problem for 1.7.16 in 1.8 mode #2057

Closed
mislav opened this issue Oct 19, 2014 · 6 comments
Closed

Rubygems broken due to psych problem for 1.7.16 in 1.8 mode #2057

mislav opened this issue Oct 19, 2014 · 6 comments
Milestone

Comments

@mislav
Copy link

mislav commented Oct 19, 2014

Script to reproduce that emulates what Rubygems' load_yaml does:

JRUBY_OPTS=--1.8 jruby -rubygems -e '
  begin
    gem "psych"
  rescue Gem::LoadError
  end
  begin
    require "psych"
  rescue LoadError
    warn $!.to_s
  end
'

Instead of a LoadError because psych isn't available on 1.8, we get:

Errno::ENOENT: No such file or directory - /opt/rubies/jruby-1.7.16/lib/ruby/gems/shared/gems/axiom-types-0.1.1/lib/psych
                      file? at org/jruby/RubyFileTest.java:131
  contains_requirable_file? at /opt/rubies/jruby-1.7.16/lib/ruby/shared/rubygems/basic_specification.rb:46
                       any? at org/jruby/RubyEnumerable.java:1467
  contains_requirable_file? at /opt/rubies/jruby-1.7.16/lib/ruby/shared/rubygems/basic_specification.rb:46
                       any? at org/jruby/RubyEnumerable.java:1467
  contains_requirable_file? at /opt/rubies/jruby-1.7.16/lib/ruby/shared/rubygems/basic_specification.rb:44
      find_inactive_by_path at /opt/rubies/jruby-1.7.16/lib/ruby/shared/rubygems/specification.rb:898
                       find at org/jruby/RubyEnumerable.java:592
      find_inactive_by_path at /opt/rubies/jruby-1.7.16/lib/ruby/shared/rubygems/specification.rb:897
               try_activate at /opt/rubies/jruby-1.7.16/lib/ruby/shared/rubygems.rb:183
                    require at /opt/rubies/jruby-1.7.16/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:132
                  load_yaml at /opt/rubies/jruby-1.7.16/lib/ruby/shared/rubygems.rb:644
                  load_file at /opt/rubies/jruby-1.7.16/lib/ruby/shared/rubygems/config_file.rb:327
                 initialize at /opt/rubies/jruby-1.7.16/lib/ruby/shared/rubygems/config_file.rb:196
           do_configuration at /opt/rubies/jruby-1.7.16/lib/ruby/shared/rubygems/gem_runner.rb:74
                        run at /opt/rubies/jruby-1.7.16/lib/ruby/shared/rubygems/gem_runner.rb:39
                     (root) at /opt/boxen/rbenv/versions/jruby-1.7.16/bin/jgem:21
                       load at org/jruby/RubyKernel.java:1076
                     (root) at /opt/boxen/rbenv/versions/jruby-1.7.16/bin/gem:4

This breaks the simplest of Rubygems operations on the command-line, such as:

JRUBY_OPTS=--1.8 gem env path
@mislav
Copy link
Author

mislav commented Oct 19, 2014

I've realized that this and #2040 #2032 are caused by the same issue: predicate methods on File are broken because they error out on missing files instead of returning false. Many methods in RubyFileTest.java on 1.7.16 seem to be affected.

$ java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

$ RBENV_VERSION=2.1.3 ruby -e 'p File.readable?("nonexist") || File.executable?("nonexist")'
false

$ RBENV_VERSION=jruby-1.7.16 ruby -e 'p File.readable?("nonexist") || File.executable?("nonexist")'
Errno::ENOENT: No such file or directory - /Users/mislav/p/rbenv/nonexist
  readable? at org/jruby/RubyFileTest.java:202
     (root) at -e:1

OS X 10.9.5

/cc @enebo @mulvaney @rtyler
/cc @headius #1979

@mislav
Copy link
Author

mislav commented Nov 18, 2014

@mkristian Are you saying this is now fixed in 1_7 stable branch? #2032 (comment)

Because I'm seeing the same error in JRuby 9.0.0.0 snapshot too:

$ ruby -v
jruby 9.0.0.0.dev-SNAPSHOT (2.2.0p0) 2014-11-18 0cfdfe5 Java HotSpot(TM) 64-Bit Server VM 24.71-b01 on 1.7.0_71-b14 +jit [darwin-x86_64]

$ gem i ...
Errno::ENOENT: No such file or directory - /.gem/jruby/2.2

$ mkdir -p ~/.gem/jruby/2.2
$ gem i ...
# now gets further, but often fails with different problems, depending on the gem

When will there be another release of 1.7.x to fix this and will the patch also make it to the 9000 branch? Because in the meantime I find the most recent JRuby releases utterly broken, with most RubyGems functionality not working.

@mkristian
Copy link
Member

@mislav a merge to master is pending but will come soon

can not give a hint about the release of 1.7.17 but it will come

@mkristian
Copy link
Member

@mislav your code example from the very beginning does work with jruby-1_7 - could you verify it on your side ? BTW the irb problem #2040, #2052, #1983 are still open

@mislav
Copy link
Author

mislav commented Nov 20, 2014

@mkristian JRuby 1.7.16.1 is still affected:

$ RBENV_VERSION=2.1.5 ruby -e 'File.file? "nonexist"' && echo OK
OK

$ RBENV_VERSION=jruby-1.7.16.1 ruby -e 'File.file? "nonexist"'
Errno::ENOENT: No such file or directory - /Users/mislav/p/ruby-build/nonexist
   file? at org/jruby/RubyFileTest.java:131
  (root) at -e:1

If you wanted me to test the jruby-1_7 branch from git, how do I do that?

@mkristian
Copy link
Member

@mislav I meant the jruby-1_7 but bin/jruby -e 'File.file? "nonexist"' just works fine now. thanx - closing issue

@mkristian mkristian added this to the JRuby 1.7.17 milestone Nov 20, 2014
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

2 participants