Skip to content

require_relative fails for relative paths within jars on Windows #3197

@hakanai

Description

@hakanai

We use gems in a jar to simplify distribution of the gems used for test runs.

When requiring rspec, rspec internally uses require_relative, which then fails. I notice there is a weird mix of the two different slash directions, which probably explains why I'm not seeing the same problem on OSX:

Errno::ENOENT: No such file or directory - C:\hudson\workspace\trunk-functional-tests\os\windows\dependencies\jruby\jruby-testing-gems.jar!\gems\rspec-support-3.3.0\lib\rspec\support.rb
                        realpath at org/jruby/RubyFile.java:805
                require_relative at uri:classloader:/jruby/kernel/kernel.rb:21
                block in Support at c:/hudson/workspace/trunk-functional-tests/os/windows/dependencies/jruby/jruby-testing-gems.jar!/gems/rspec-support-3.3.0/lib/rspec/support.rb:28
                            call at org/jruby/RubyProc.java:308
  block in require_rspec_support at c:/hudson/workspace/trunk-functional-tests/os/windows/dependencies/jruby/jruby-testing-gems.jar!/gems/rspec-support-3.3.0/lib/rspec/support.rb:19
                <module:Support> at c:/hudson/workspace/trunk-functional-tests/os/windows/dependencies/jruby/jruby-testing-gems.jar!/gems/rspec-support-3.3.0/lib/rspec/support.rb:29
                  <module:RSpec> at c:/hudson/workspace/trunk-functional-tests/os/windows/dependencies/jruby/jruby-testing-gems.jar!/gems/rspec-support-3.3.0/lib/rspec/support.rb:2
                           <top> at c:/hudson/workspace/trunk-functional-tests/os/windows/dependencies/jruby/jruby-testing-gems.jar!/gems/rspec-support-3.3.0/lib/rspec/support.rb:1
                         require at org/jruby/RubyKernel.java:940
                          (root) at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
                           <top> at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
                         require at org/jruby/RubyKernel.java:940
                          (root) at c:/hudson/workspace/trunk-functional-tests/os/windows/dependencies/jruby/jruby-testing-gems.jar!/gems/rspec-core-3.3.2/lib/rspec/core.rb:5
                           <top> at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
                         require at org/jruby/RubyKernel.java:940
                         require at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
                           <top> at c:\hudson\workspace\trunk-functional-tests\os\windows/functional-tests/run-rspec.rb:8

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