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

In MS Windows __FILE__ result changed in 9.2.0.0 #5662

Open
jbaiza opened this Issue Mar 22, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@jbaiza
Copy link

jbaiza commented Mar 22, 2019

In our application, we change the working directory to MS Windows shortened 8.3 path to avoid a problem with paths longer than 260 symbols - #3995.
We migrated our used JRuby to 9.2.x and this workaround stopped to work. During our investigation, we found out that the results of __FILE__ changed under Windows.

Environment

Provide at least:

  • JRuby version (jruby -v) and command line (flags, JRUBY_OPTS, etc):

jruby 9.2.6.0 (2.5.3) 2019-02-11 15ba00b Java HotSpot(TM) 64-Bit Server VM 25.201-b09 on 1.8.0_201-b09 +jit [mswin32-x86_64]

  • Operating system and platform (e.g. uname -a):

Windows Server 2012 R2

Expected Behavior

Under JRuby 9.1.17.0 and MRI 2.5.3 __FILE__ returns a shortened 8.3 directory path if a filename contains a shortened path.

c:\Program Files>java -jar jruby-complete-9.1.17.0.jar test.rb
C:/PROGRA~1/test2.rb

c:\Program Files>C:\ruby-2.5.3\bin\ruby test.rb
C:/PROGRA~1/test2.rb
  • Example scripts - under C:\Program Files create two files:

test.rb:

require 'C:\PROGRA~1\test2.rb'

test2.rb:

puts __FILE__

Actual Behavior

__FILE__ returns full path, not shortened one.

JRuby 9.2.6.0:

c:\Program Files>jruby test.rb
C:/Program Files/test2.rb

JRuby 9.2.0.0:

c:\Program Files> java -jar jruby-complete-9.2.0.0.jar test.rb
C:/Program Files/test2.rb
@headius

This comment has been minimized.

Copy link
Member

headius commented Apr 9, 2019

I am surprised that MRI does not expand these paths, but we should follow suit. I am guessing this is failing for the same reasons as other bugs here about expanded symlinks in loaded files. Marking for 9.2.8 since I'll be landing the new load/require stuff there.

@headius headius added this to the JRuby 9.2.8.0 milestone Apr 9, 2019

@headius

This comment has been minimized.

Copy link
Member

headius commented Apr 9, 2019

@enebo There's a possibility this is some change in IR unrelated to load, maybe?

@enebo

This comment has been minimized.

Copy link
Member

enebo commented Apr 9, 2019

@headius I forgot I did look into this for about 3-4 minutes. I can tell you we get the name of the FILE from what is passed into parser. So this 8.3 name is coming from require/load service itself.

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.