JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-5314

Classloader-sourced "load" will attempt to read a dir as a Ruby file

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: JRuby 1.6RC1
    • Fix Version/s: None
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Number of attachments :
      0

      Description

      This is pretty wacky. We must not be checking if a resource in classloader is a directory when doing a 'load'. Not sure why this wouldn't affect 'require'.

      ~/projects/jruby ➔ ls -a blah
      .			..			.this_is_not_valid_ruby
      
      ~/projects/jruby ➔ CLASSPATH=. jruby -e "load 'blah'"
      org/jruby/RubyKernel.java:1066:in `load': classpath:/./blah:1: syntax error, unexpected tDOT (SyntaxError)
      
      .this_is_not_valid_ruby
      ^
      	from -e:1:in `(root)'
      
      ~/projects/jruby ➔ jar cvf yuck.jar blah/.this_is_not_valid_ruby 
      added manifest
      adding: blah/.this_is_not_valid_ruby(in = 0) (out= 0)(stored 0%)
      
      ~/projects/jruby ➔ CLASSPATH=yuck.jar jruby -e "load 'blah'"
      org/jruby/RubyKernel.java:1066:in `load': classpath:/./blah:1: syntax error, unexpected tDOT (SyntaxError)
      
      .this_is_not_valid_ruby
      ^
      	from -e:1:in `(root)'
      

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        FYI, when using "require" it properly produces a LoadError:

        ~/projects/jruby ➔ CLASSPATH=yuck.jar jruby -e "require 'blah'"
        org/jruby/RubyKernel.java:1041:in `require': no such file to load -- blah (LoadError)
        	from -e:1:in `(root)'
        
        Show
        Charles Oliver Nutter added a comment - FYI, when using "require" it properly produces a LoadError: ~/projects/jruby ➔ CLASSPATH=yuck.jar jruby -e "require 'blah'" org/jruby/RubyKernel.java:1041:in `require': no such file to load -- blah (LoadError) from -e:1:in `(root)'

          People

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

            Dates

            • Created:
              Updated: