Issue Type: Bug Bug
Affects Versions: JRuby 1.7.3
Assignee: Unassigned
Components: Core Classes/Modules
Created: 09/Mar/13 11:27 AM
Description:

I am running JRuby inside OSGi bundle which starts JRuby scripting container from jruby-complete-1.7.3.jar. In this case jar is not extracted in filesystem, all files are required from class path. As a result $LOAD_PATH is set to

["classpath:/META-INF/jruby.home/lib/ruby/1.9/site_ruby",
 "classpath:/META-INF/jruby.home/lib/ruby/shared",
 "classpath:/META-INF/jruby.home/lib/ruby/1.9"]

On Linux and Mac OS X everything is working fine but on Windows

require "openssl"

is raising exception

org.jruby.rack.RackInitializationException: No such file or directory - classpath:C:/META-INF/jruby.home/lib/ruby/shared/krypt.rb
	from org/jruby/RubyFile.java:760:in `realpath'

It is happening because on Windows File.realpath is not handling path which starts with "classpath:/..." (pointing to file that should be required from class path and not from file system). And File.realpath is used by require_relative which is used by krypt.rb.

The problem can be demonstrated with the following test which is working without problems on Linux or Mac OS X:

$ java -cp jruby-complete-1.7.3.jar org.jruby.Main -S jirb
>> File.realpath("classpath:/META-INF/jruby.home/lib/ruby/shared/krypt.rb")
=> "classpath:/META-INF/jruby.home/lib/ruby/shared/krypt.rb"
>> require "classpath:/META-INF/jruby.home/lib/ruby/shared/krypt.rb"
=> true

But on Windows it is giving exception:

C:\>java -cp jruby-complete-1.7.3.jar org.jruby.Main -S jirb
irb(main):001:0> File.realpath("classpath:/META-INF/jruby.home/lib/ruby/shared/krypt.rb")
Errno::ENOENT: No such file or directory - classpath:C:/META-INF/jruby.home/lib/ruby/shared/krypt.rb
        from org/jruby/RubyFile.java:760:in `realpath'
        from (irb):1:in `evaluate'
        from org/jruby/RubyKernel.java:1066:in `eval'
        from org/jruby/RubyKernel.java:1409:in `loop'
        from org/jruby/RubyKernel.java:1174:in `catch'
        from org/jruby/RubyKernel.java:1174:in `catch'
        from file:/C:/jruby-complete-1.7.3.jar!/META-INF/jruby.home/bin/jirb:13:in `(root)'
        from org/jruby/RubyKernel.java:1046:in `load'
        from file:/C:/jruby-complete-1.7.3.jar!/jruby/commands.rb:1:in `(root)'
        from jirb:1:in `(root)'
irb(main):002:0> require "classpath:/META-INF/jruby.home/lib/ruby/shared/krypt.rb"
Errno::ENOENT: No such file or directory - classpath:C:/META-INF/jruby.home/lib/ruby/shared/krypt.rb
        from org/jruby/RubyFile.java:760:in `realpath'
        from file:/C:/jruby-complete-1.7.3.jar!/jruby/kernel19/kernel.rb:18:in `require_relative'
        from classpath:/META-INF/jruby.home/lib/ruby/shared/krypt.rb:37:in `(root)'
        from org/jruby/RubyKernel.java:1027:in `require'
        from jar:file:/C:/jruby-complete-1.7.3.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1:in `(root)'
        from jar:file:/C:/jruby-complete-1.7.3.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36:in `require'
        from org/jruby/RubyKernel.java:1066:in `eval'
        from (irb):2:in `evaluate'
        from org/jruby/RubyKernel.java:1409:in `loop'
        from org/jruby/RubyKernel.java:1174:in `catch'
        from org/jruby/RubyKernel.java:1174:in `catch'
        from org/jruby/RubyKernel.java:1046:in `load'
        from file:/C:/jruby-complete-1.7.3.jar!/META-INF/jruby.home/bin/jirb:13:in `(root)'
        from jirb:1:in `(root)'

As you can see on Windows C:/ is inserted in classpath:/META-INF/... path.

As I understand the cause for this is in Windows specific code in RubyFile.java method expandPathInternal but I have not yet debugged to exact line in this method which is causing this.

Environment: Windows
Project: JRuby
Priority: Major Major
Reporter: Raimonds Simanovskis
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to