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

__FILE__ is broken with -Djruby.compile.mode=FORCE when mixing forward and backward slashes #1256

Closed
perlun opened this issue Nov 22, 2013 · 3 comments

Comments

@perlun
Copy link
Contributor

perlun commented Nov 22, 2013

This one took me quite some time to analyze but I now believe I have a pretty good idea of the problem.

Scenario:

  • Create a subfolder called foo.
  • Create a file called foo.rb with the following content:
puts "In foo.rb, __FILE__ is #{__FILE__}"

require './foo/bar/baz.rb'
  • Create a subfolder of foo, called bar, in which the baz.rb is created with the following content:
puts "In baz.rb, __FILE__ is #{__FILE__}"
  • Run the following command (this one has been using jruby-complete, don't know yet if it affects other variants also):
java -Djruby.compile.mode=FORCE -jar jruby-complete-1.7.6.jar c:\path\to\your\folder\foo/foo.rb

Expected output:

In foo.rb, __FILE__ is c:\path\to\your\folder\foo/foo.rb
In baz.rb, __FILE__ is c:\path\to\your\folderfoo/bar/baz.rb

Note that in the second line, there is a missing slash between folder and foo, causing all kinds of weird side effects.

Now, re-run without -Djruby.compile.mode=FORCE, and you'll see this:

In foo.rb, __FILE__ is c:\path\to\your\folder\foo/foo.rb
In baz.rb, __FILE__ is c:/path/to/your/folder/foo/bar/baz.rb

Note how the path is now correct, and not only that - all the slashes are now translated to forward slashes!

Why is this? How can jruby.compile.mode affect this? 😄

As noted, this has been verified with JRuby 1.7.6. I haven't tested with 1.7.8 but I find it quite likely that it's present there also.

@perlun
Copy link
Contributor Author

perlun commented Nov 25, 2014

Any updates on this one? It would be good to be able to enable this...

@perlun
Copy link
Contributor Author

perlun commented Apr 6, 2016

Let's kill this one now, it's age-old.

@perlun perlun closed this as completed Apr 6, 2016
@headius
Copy link
Member

headius commented Apr 6, 2016 via email

@enebo enebo added this to the Invalid or Duplicate milestone Apr 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants