Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • 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.
        Hide
        Charles Oliver Nutter added a comment -

        JRuby has moved bug tracking to Github, accessible via our Github page at https://github.com/jruby/jruby/issues, or via http://bugs.jruby.org. In addition, this bug has not been updated in over two years.

        We have decided to close down these old JIRA issues.

        If your report is still a problem on current JRuby versions (1.7.18 or master/9.0.0.0), please re-file the bug at http://bugs.jruby.org.

        You can contact us on the JRuby mailing lists, Freenode IRC channel #jruby, or the @jruby Twitter account if you are unsure how to proceed.

        Show
        Charles Oliver Nutter added a comment - JRuby has moved bug tracking to Github, accessible via our Github page at https://github.com/jruby/jruby/issues , or via http://bugs.jruby.org . In addition, this bug has not been updated in over two years. We have decided to close down these old JIRA issues. If your report is still a problem on current JRuby versions (1.7.18 or master/9.0.0.0), please re-file the bug at http://bugs.jruby.org . You can contact us on the JRuby mailing lists, Freenode IRC channel #jruby, or the @jruby Twitter account if you are unsure how to proceed.

          People

          • Assignee:
            Unassigned
            Reporter:
            Lachie Cox

            Dates

            • Created:
              Updated:
              Resolved: