Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
charliesome opened this Issue Mar 11, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@charliesome
Copy link
Contributor

charliesome commented Mar 11, 2013

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
@headius

This comment has been minimized.

Copy link
Member

headius commented Mar 14, 2013

It seems to be an issue with b.rb getting FILE as "./b.rb", which then doesn't canonicalize right with the .. in there. If you run b.rb directly or require it from a.rb without using ./, it works ok.

I'm looking into why we're presenting FILE as the relative version; it should be the canonical path, I believe.

@headius headius closed this in 8a626e1 Mar 14, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.