Skip to content

Require paths with .. in them are not normalized #575

@haileys

Description

@haileys

This requires 3 files to reproduce:

a.rb:

require "./b"

b.rb:

require "#{__FILE__}/../c"

c.rb:

puts "ok"

In Ruby 1.9 and 2.0, running a.rb prints "ok" to the terminal:

$ ruby a.rb
ok

In JRuby, I get a LoadError instead:

$ ruby a.rb
LoadError: no such file to load -- /Users/charlie/crap/jruby-bug/./b.rb/../c
  require at org/jruby/RubyKernel.java:1027
  require at /Users/charlie/.rubies/jruby-1.7.3/lib/ruby/shared/rubygems/custom_require.rb:36
   (root) at /Users/charlie/crap/jruby-bug/./b.rb:1
  require at org/jruby/RubyKernel.java:1027
   (root) at /Users/charlie/.rubies/jruby-1.7.3/lib/ruby/shared/rubygems/custom_require.rb:1
   (root) at a.rb:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions