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_relative wrong in Jruby1.7 with symbolic links #3169

Closed
savelandr opened this issue Jul 23, 2015 · 4 comments
Closed

require_relative wrong in Jruby1.7 with symbolic links #3169

savelandr opened this issue Jul 23, 2015 · 4 comments

Comments

@savelandr
Copy link

Setup:

Folder hierarchy:

$ tree
.
├── my_dir
│   ├── helper.rb
│   └── test.rb -> ../other_dir/test.rb
└── other_dir
    ├── helper.rb
    └── test.rb

Contents:

$ cat my_dir/helper.rb 
puts "helper in my_dir"

$ cat other_dir/helper.rb 
puts "helper in other_dir"

$ cat other_dir/test.rb 
require_relative 'helper'

Jruby 1.7.14 test:

$ ruby -v
jruby 1.7.14 (1.9.3p392) 2014-08-27 d368971 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_51-b16 +jit [linux-amd64]

$ ruby my_dir/test.rb 
helper in my_dir

Jruby 9000 test:

$ ruby -v
jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 Java HotSpot(TM) 64-Bit Server VM 25.51-b03 on 1.8.0_51-b16 +jit [linux-amd64]

$ ruby my_dir/test.rb 
helper in other_dir
@enebo enebo changed the title require_relative Jruby9000 not consistent with Jruby1.7 with symbolic links require_relative wrong in Jruby1.7 with symbolic links Jul 23, 2015
@enebo enebo added this to the JRuby 1.7.22 milestone Jul 23, 2015
@enebo
Copy link
Member

enebo commented Jul 23, 2015

I typed this in weirdly and quickly so the output is a little different but I believe this is a bug in 1.7. JRuby 9k matches MRI in both 2.2 and 1.9.3:

system ~/work/snippets 1699% mri22 my_dir/test.rb 
OTHER HELP
system ~/work/snippets 1700% jruby my_dir/test.rb 
OTHER HELP
system ~/work/snippets 1701% mri19 my_dir/test.rb 
OTHER HELP
system ~/work/snippets 1702% ../jruby-1_7/bin/jruby my_dir/test.rb 
Heling in mydir

@savelandr
Copy link
Author

You're right, I just installed 1.9.3 and 2.2.2 and they both behave the same as Jruby 9000. Dang, I had gotten pretty used to this behavior... Thanks!

@headius
Copy link
Member

headius commented Aug 18, 2015

This is the same issue as #3092, fixed for 9k in 7e7292e. I'll apply the require_relative fix for this bug as well as the File.realdirpath fix.

headius added a commit that referenced this issue Aug 18, 2015
@headius
Copy link
Member

headius commented Aug 18, 2015

This still needs a spec somewhere, but it has been fixed for 1.7.22.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants