Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: JRuby 1.6.7, JRuby 1.7.0.pre2
    • Fix Version/s: None
    • Component/s: Embedding, Launcher
    • Labels:
      None
    • Environment:
      OS X Mountain Lion, Apple Java 1.6, Oracle Java 1.7
      linux (ubuntu on ec2) openjdk 1.6
    • Number of attachments :
      1

      Description

      Using jruby-complete.jar with -S, a script (e.g. gem) on the PATH is used rather than the internal version (i.e. META-INF/jruby.home/bin/gem).

      In other words, its not possible to use the internal version of gem if a script named gem is on the PATH.

      The attached shell script demonstrates the problem.

      1. test.sh
        0.2 kB
        Lachie Cox

        Activity

        Hide
        Hiro Asari added a comment - - edited

        From what I can tell, we are searching the JAR, but failing to pick bin/gem. This failure leads to the search in $PATH, and the reported issue manifests.

        Show
        Hiro Asari added a comment - - edited From what I can tell, we are searching the JAR, but failing to pick bin/gem . This failure leads to the search in $PATH , and the reported issue manifests.
        Hide
        Lachie Cox added a comment -

        In my digging into this issue I also tried this ruby script to simulate what's not working in resolveScript

         
        require 'java'
        
        cfg = Java::OrgJruby::RubyInstanceConfig.new
        puts "jruby.home #{ cfg.getJRubyHome }"
        
        Java::OrgJrubyUtil::JRubyFile.create cfg.getJRubyHome, "bin/gem"
        

        it ran as follows:

        $ java -cp ~/.m2/repository/org/jruby/jruby-complete/1.6.7.2/jruby-complete-1.6.7.2.jar org.jruby.Main ./test.rb
        
        jruby.home file:/Users/lachie/.m2/repository/org/jruby/jruby-complete/1.6.7.2/jruby-complete-1.6.7.2.jar!/META-INF/jruby.home
        NativeException: java.lang.IllegalArgumentException: Neither current working directory (file:/Users/lachie/.m2/repository/org/jruby/jruby-complete/1.6.7.2/jruby-complete-1.6.7.2.jar!/META-INF/jruby.home) nor pathname (bin/gem) led to an absolute path
          (root) at ./test.rb:6
        

        Seems as though the problem is rooted in org.jruby.util.JRubyFile < jnr.posix.JavaSecuredFile < java.io.File

        Because jruby.home is formatted as a file URL (starts with "file:") java.io.File#isAbsolute returns false.

        I tried setting jruby.home to the same path without the "file:" but it caused problems later on in the JRuby startup process.

        Show
        Lachie Cox added a comment - In my digging into this issue I also tried this ruby script to simulate what's not working in resolveScript require 'java' cfg = Java::OrgJruby::RubyInstanceConfig. new puts "jruby.home #{ cfg.getJRubyHome }" Java::OrgJrubyUtil::JRubyFile.create cfg.getJRubyHome, "bin/gem" it ran as follows: $ java -cp ~/.m2/repository/org/jruby/jruby-complete/1.6.7.2/jruby-complete-1.6.7.2.jar org.jruby.Main ./test.rb jruby.home file:/Users/lachie/.m2/repository/org/jruby/jruby-complete/1.6.7.2/jruby-complete-1.6.7.2.jar!/META-INF/jruby.home NativeException: java.lang.IllegalArgumentException: Neither current working directory (file:/Users/lachie/.m2/repository/org/jruby/jruby-complete/1.6.7.2/jruby-complete-1.6.7.2.jar!/META-INF/jruby.home) nor pathname (bin/gem) led to an absolute path (root) at ./test.rb:6 Seems as though the problem is rooted in org.jruby.util.JRubyFile < jnr.posix.JavaSecuredFile < java.io.File Because jruby.home is formatted as a file URL (starts with "file:") java.io.File#isAbsolute returns false. I tried setting jruby.home to the same path without the "file:" but it caused problems later on in the JRuby startup process.

          People

          • Assignee:
            Unassigned
            Reporter:
            Lachie Cox
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: