Skip to content

bin/{rake,rdoc,ri} broken by default in jruby 1.7.9 #1349

@jeremyevans

Description

@jeremyevans

It looks like jruby-1.7.9 stopped shipping the rake gemspec in between 1.7.6 and 1.7.9:

$ tar ztf /usr/ports/distfiles/jruby-bin-1.7.6.tar.gz | fgrep gemspec
jruby-1.7.6/lib/ruby/2.0/test/unit/test-unit.gemspec
jruby-1.7.6/lib/ruby/gems/shared/specifications/rake-10.1.0.gemspec
$ tar ztf /usr/ports/distfiles/jruby-bin-1.7.9.tar.gz | fgrep gemspec
jruby-1.7.9/lib/ruby/2.0/test/unit/test-unit.gemspec

This leads to the following situation:

c:\jruby-1.7.9>bin\jruby.exe -vS rake --version
jruby 1.7.9 (1.9.3p392) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.7.0_07-b10 [Windows 7-amd64]
Gem::LoadError: Could not find 'rake' (>= 0) among 1 total gem(s)
  to_specs at c:/jruby-1.7.9/lib/ruby/shared/rubygems/dependency.rb:298
   to_spec at c:/jruby-1.7.9/lib/ruby/shared/rubygems/dependency.rb:309
       gem at c:/jruby-1.7.9/lib/ruby/shared/rubygems/core_ext/kernel_gem.rb:47
    (root) at c:/jruby-1.7.9/bin/rake:22

The same is true for rdoc and ri, except that they were broken even in 1.7.6 (note how their gemspecs aren't present in either tarball above).

It's fairly trivial to determine the reason. All three files use the standard rubygems shim, which does:

gem 'rake', version
load Gem.bin_path('rake', 'rake', version)

If you don't ship the gemspec, the gem call raises an exception.

I've tested this both on Windows using the exe+jre and OpenBSD using the bin tarball. As a work around, you can copy the real executable over the shim, or just install the gems separately. However, the correct fix is to ship the gemspecs for all binaries that use rubygems shims.

Note that this doesn't just effect binary usage, any code that calls gem 'rake' or something similar will break as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions