Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: JRuby 1.6RC3
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      This is a regression. Previous versions of jruby-complete.jar didn't percent-escape spaces in the paths.

      $ pwd
      /tmp
      $ java -jar jruby-complete.jar -v
      jruby 1.6.0.dev (ruby 1.8.7 patchlevel 249) (2010-12-29 ab3899a) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_22) [darwin-x86_64-java]
      $ java -jar jruby-complete.jar -r set -e 'p $LOAD_PATH'
      ["file:/private/tmp/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8", "file:/private/tmp/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared", "file:/private/tmp/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/1.8", "."]
      $ mkdir "path with spaces"
      $ mv jruby-complete.jar path\ with\ spaces
      $ java -jar path\ with\ spaces/jruby-complete.jar -r set -e 'p $LOAD_PATH'
      org.jruby.exceptions.RaiseException: (LoadError) no such file to load – set
      $ java -jar path\ with\ spaces/jruby-complete.jar -e 'p $LOAD_PATH'
      ["file:/private/tmp/path%20with%20spaces/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8", "file:/private/tmp/path%20with%20spaces/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared", "file:/private/tmp/path%20with%20spaces/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/1.8", "."]
      $

        Issue Links

          Activity

          Hide
          David Calavera added a comment -

          pushed in d4a6279

          Show
          David Calavera added a comment - pushed in d4a6279
          Hide
          Nick Sieger added a comment -

          This fix (URL decoding) is not correct. It fixes spaces (%20) but breaks when there's a + in the path, such as java.io.tmpdir on OS X.

          Currently searching for a catch-all solution.

          Show
          Nick Sieger added a comment - This fix (URL decoding) is not correct. It fixes spaces (%20) but breaks when there's a + in the path, such as java.io.tmpdir on OS X. Currently searching for a catch-all solution.
          Hide
          Nick Sieger added a comment -

          Hoping that this is the last round of changes for determining jruby.home. 64c3a02c.

          Show
          Nick Sieger added a comment - Hoping that this is the last round of changes for determining jruby.home. 64c3a02c.
          Hide
          David Lee added a comment -

          Just tested this out with 1.6.0.RC2:

          Application initialization failed: no such file to load – rack
          from file:/Users/uleexda/tomcat%20test/webapps/db_query/WEB-INF/lib/jruby-rack-1.0.6.jar!/vendor/rack.rb:7:in `(root)'
          from org/jruby/RubyKernel.java:1038:in `require'
          from file:/Users/uleexda/tomcat%20test/webapps/db_query/WEB-INF/lib/jruby-rack-1.0.6.jar!/vendor/rack.rb:28:in `boot!'
          from file:/Users/uleexda/tomcat%20test/webapps/db_query/WEB-INF/lib/jruby-rack-1.0.6.jar!/jruby/rack/boot/rack.rb:10:in `(class Rack)'
          from file:/Users/uleexda/tomcat%20test/webapps/db_query/WEB-INF/lib/jruby-rack-1.0.6.jar!/jruby/rack/boot/rack.rb:8:in `(root)'
          from org/jruby/RubyKernel.java:1063:in `load'
          from file:/Users/uleexda/tomcat%20test/webapps/db_query/WEB-INF/lib/jruby-rack-1.0.6.jar!/jruby/rack/boot/rack.rb:1:in `(root)'

          at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:197)
          at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:58)
          at org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:95)
          at org.jruby.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:28)
          at org.jruby.rack.RackFilter.doFilter(RackFilter.java:62)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
          at java.lang.Thread.run(Thread.java:680)

          jruby-jars is at 1.6.0.RC2 as well. I tried both jruby-rack-1.0.6.RC1 and compiled it from https://github.com/nicksieger/jruby-rack as well. Both are producing the error still. The moment I rename the "tomcat test" directory back to "tomcat", its loading just fine. If I need to test something or provide more information, I definitely will.

          Show
          David Lee added a comment - Just tested this out with 1.6.0.RC2: Application initialization failed: no such file to load – rack from file:/Users/uleexda/tomcat%20test/webapps/db_query/WEB-INF/lib/jruby-rack-1.0.6.jar!/vendor/rack.rb:7:in `(root)' from org/jruby/RubyKernel.java:1038:in `require' from file:/Users/uleexda/tomcat%20test/webapps/db_query/WEB-INF/lib/jruby-rack-1.0.6.jar!/vendor/rack.rb:28:in `boot!' from file:/Users/uleexda/tomcat%20test/webapps/db_query/WEB-INF/lib/jruby-rack-1.0.6.jar!/jruby/rack/boot/rack.rb:10:in `(class Rack)' from file:/Users/uleexda/tomcat%20test/webapps/db_query/WEB-INF/lib/jruby-rack-1.0.6.jar!/jruby/rack/boot/rack.rb:8:in `(root)' from org/jruby/RubyKernel.java:1063:in `load' from file:/Users/uleexda/tomcat%20test/webapps/db_query/WEB-INF/lib/jruby-rack-1.0.6.jar!/jruby/rack/boot/rack.rb:1:in `(root)' at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:197) at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:58) at org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:95) at org.jruby.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:28) at org.jruby.rack.RackFilter.doFilter(RackFilter.java:62) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:680) jruby-jars is at 1.6.0.RC2 as well. I tried both jruby-rack-1.0.6.RC1 and compiled it from https://github.com/nicksieger/jruby-rack as well. Both are producing the error still. The moment I rename the "tomcat test" directory back to "tomcat", its loading just fine. If I need to test something or provide more information, I definitely will.
          Hide
          Charles Oliver Nutter added a comment -

          Appears to still be broken

          Show
          Charles Oliver Nutter added a comment - Appears to still be broken
          Hide
          Robert Glaser added a comment -

          Still broken for me with jruby-jars 1.6.0.rc2 and jruby-rack 1.6.0.rc1

          Show
          Robert Glaser added a comment - Still broken for me with jruby-jars 1.6.0.rc2 and jruby-rack 1.6.0.rc1
          Hide
          Charles Oliver Nutter added a comment -

          This now appears to be working for me from a master build. Can someone else confirm this using a jruby-complete.jar from http://ci.jruby.org/snapshots?

          ~/projects/jruby ➔ mkdir dir\ with\ spaces
          
          ~/projects/jruby ➔ mv jruby-complete.jar dir\ with\ spaces/
          
          ~/projects/jruby ➔ java -jar dir\ with\ spaces/jruby-complete.jar -r set -e 'p $LOAD_PATH'
          ["file:/Users/headius/projects/jruby/dir with spaces/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8", "file:/Users/headius/projects/jruby/dir with spaces/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared", "file:/Users/headius/projects/jruby/dir with spaces/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/1.8", "."]
          
          Show
          Charles Oliver Nutter added a comment - This now appears to be working for me from a master build. Can someone else confirm this using a jruby-complete.jar from http://ci.jruby.org/snapshots? ~/projects/jruby ➔ mkdir dir\ with\ spaces ~/projects/jruby ➔ mv jruby-complete.jar dir\ with\ spaces/ ~/projects/jruby ➔ java -jar dir\ with\ spaces/jruby-complete.jar -r set -e 'p $LOAD_PATH' ["file:/Users/headius/projects/jruby/dir with spaces/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8", "file:/Users/headius/projects/jruby/dir with spaces/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared", "file:/Users/headius/projects/jruby/dir with spaces/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/1.8", "."]
          Hide
          Charles Oliver Nutter added a comment -

          Also, FWIW, if there are still issues with jruby-rack, they should be filed separately. This issue was only about jruby-complete.jar standalone.

          Show
          Charles Oliver Nutter added a comment - Also, FWIW, if there are still issues with jruby-rack, they should be filed separately. This issue was only about jruby-complete.jar standalone.
          Hide
          Charles Oliver Nutter added a comment -

          See JRUBY-5337 for ongoing jruby-rack discussion. The most recent comments talk about issues running from within dirs with spaces.

          Show
          Charles Oliver Nutter added a comment - See JRUBY-5337 for ongoing jruby-rack discussion. The most recent comments talk about issues running from within dirs with spaces.
          Hide
          Syver Enstad added a comment -

          require_relative call from inside jruby-complete.jar fails when jruby-complete.jar is in a directory with spaces

          To reproduce:

          1. Make krypt.rb perform a require_relative which makes File.realpath raise in jruby 1.7.3 and makes require raise in 614ba113ee3e91168221bd3bb2c872f093dc9f63 (todays HEAD)

          Output from todays HEAD

          ~/.wine/drive_c/Program Files (x86)/flesk
          $ java -jar jruby-complete.jar -e "require 'krypt'"
          LoadError: no such file to load – jar:file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/krypt_missing
          require at org/jruby/RubyKernel.java:1028
          require at jar:file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36
          require_relative at file:/home/syvensta/.wine/drive_c/Program Files (x86)/flesk/jruby-complete.jar!/jruby/kernel19/kernel.rb:19
          (root) at jar:file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/krypt.rb:37
          require at org/jruby/RubyKernel.java:1028
          (root) at jar:file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1
          (root) at -e:1

          Output with 1.7.3 (actually I have patched HEAD with the 1.7.3 version of kernel.rb)
          ~/.wine/drive_c/Program Files (x86)/flesk
          $ java -jar jruby-complete.jar -e "require 'krypt'"
          Errno::ENOENT: No such file or directory - jar:file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/krypt.rb
          realpath at org/jruby/RubyFile.java:763
          require_relative at file:/home/syvensta/.wine/drive_c/Program Files (x86)/flesk/jruby-complete.jar!/jruby/kernel19/kernel.rb:23
          (root) at jar:file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/krypt.rb:37
          require at org/jruby/RubyKernel.java:1028
          (root) at jar:file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1
          (root) at -e:1

          The problem seems to be that we pass an urlencoded url to the File class (RubyFile and friends) which they do not support.

          Show
          Syver Enstad added a comment - require_relative call from inside jruby-complete.jar fails when jruby-complete.jar is in a directory with spaces To reproduce: Make krypt.rb perform a require_relative which makes File.realpath raise in jruby 1.7.3 and makes require raise in 614ba113ee3e91168221bd3bb2c872f093dc9f63 (todays HEAD) Output from todays HEAD ~/.wine/drive_c/Program Files (x86)/flesk $ java -jar jruby-complete.jar -e "require 'krypt'" LoadError: no such file to load – jar: file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/krypt_missing require at org/jruby/RubyKernel.java:1028 require at jar: file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36 require_relative at file:/home/syvensta/.wine/drive_c/Program Files (x86)/flesk/jruby-complete.jar!/jruby/kernel19/kernel.rb:19 (root) at jar: file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/krypt.rb:37 require at org/jruby/RubyKernel.java:1028 (root) at jar: file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1 (root) at -e:1 Output with 1.7.3 (actually I have patched HEAD with the 1.7.3 version of kernel.rb) ~/.wine/drive_c/Program Files (x86)/flesk $ java -jar jruby-complete.jar -e "require 'krypt'" Errno::ENOENT: No such file or directory - jar: file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/krypt.rb realpath at org/jruby/RubyFile.java:763 require_relative at file:/home/syvensta/.wine/drive_c/Program Files (x86)/flesk/jruby-complete.jar!/jruby/kernel19/kernel.rb:23 (root) at jar: file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/krypt.rb:37 require at org/jruby/RubyKernel.java:1028 (root) at jar: file:/home/syvensta/.wine/drive_c/Program%20Files%20(x86)/flesk/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1 (root) at -e:1 The problem seems to be that we pass an urlencoded url to the File class (RubyFile and friends) which they do not support.
          Hide
          Syver Enstad added a comment -

          If we change require_relative in kernel.rb to decode the uri before passing it to the File methods my case seems to work fine. I am not sure if it is a good idea that
          the Kernel module depends on the URI class though, but it seems to me that either:

          • the RubyFile methods must support URI encoded uri's
          • require_relative must decode the uri's before passing them onward
          • the uri string that we get from caller.first at kernel.rb:14 should not contain an uri encoded value

          java -jar jruby-complete.jar -e "require 'krypt'; puts 'success'"
          success

          I wasn't able to attach anything to this issue so the patch is inline. (should I have cloned this issue or created another issue instead)
          – PATCH –

          From bbcc653bb47850171158776f15388a53858f04e5 Mon Sep 17 00:00:00 2001
          From: Syver Enstad <syver.enstad@cisco.com>
          Date: Wed, 24 Apr 2013 19:29:07 +0200
          Subject: [PATCH] Fix the require_relative issue


          src/jruby/kernel19/kernel.rb | 3 +++
          1 file changed, 3 insertions

          diff --git a/src/jruby/kernel19/kernel.rb b/src/jruby/kernel19/kernel.rb
          index ae2cbdf..ee8efe7 100644
          — a/src/jruby/kernel19/kernel.rb
          +++ b/src/jruby/kernel19/kernel.rb
          @@ -1,3 +1,5 @@
          +require 'uri'
          +
          module Kernel
          module_function
          def require_relative(relative_feature)
          @@ -15,6 +17,7 @@ module Kernel
          if /\A((.*))/ =~ file # eval, etc.
          raise LoadError, "cannot infer basepath"
          end
          + file = URI.decode(file)
          absolute_feature = File.expand_path(relative_feature, File.dirname(file))
          require absolute_feature
          end

          1.7.10.4

          Show
          Syver Enstad added a comment - If we change require_relative in kernel.rb to decode the uri before passing it to the File methods my case seems to work fine. I am not sure if it is a good idea that the Kernel module depends on the URI class though, but it seems to me that either: the RubyFile methods must support URI encoded uri's require_relative must decode the uri's before passing them onward the uri string that we get from caller.first at kernel.rb:14 should not contain an uri encoded value java -jar jruby-complete.jar -e "require 'krypt'; puts 'success'" success I wasn't able to attach anything to this issue so the patch is inline. (should I have cloned this issue or created another issue instead) – PATCH – From bbcc653bb47850171158776f15388a53858f04e5 Mon Sep 17 00:00:00 2001 From: Syver Enstad <syver.enstad@cisco.com> Date: Wed, 24 Apr 2013 19:29:07 +0200 Subject: [PATCH] Fix the require_relative issue — src/jruby/kernel19/kernel.rb | 3 +++ 1 file changed, 3 insertions diff --git a/src/jruby/kernel19/kernel.rb b/src/jruby/kernel19/kernel.rb index ae2cbdf..ee8efe7 100644 — a/src/jruby/kernel19/kernel.rb +++ b/src/jruby/kernel19/kernel.rb @@ -1,3 +1,5 @@ +require 'uri' + module Kernel module_function def require_relative(relative_feature) @@ -15,6 +17,7 @@ module Kernel if /\A((.*))/ =~ file # eval, etc. raise LoadError, "cannot infer basepath" end + file = URI.decode(file) absolute_feature = File.expand_path(relative_feature, File.dirname(file)) require absolute_feature end – 1.7.10.4

            People

            • Assignee:
              Charles Oliver Nutter
              Reporter:
              Jari Bakken
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: