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.symlink broken on windows #4669

Closed
cshupp1 opened this issue Jun 14, 2017 · 6 comments
Closed

File.symlink broken on windows #4669

cshupp1 opened this issue Jun 14, 2017 · 6 comments

Comments

@cshupp1
Copy link

cshupp1 commented Jun 14, 2017

On windows 10 JRuby cannot use File.symlink (MRI ruby can). Consider the following:

Not an admin(MRI):

irb(main):002:0> RUBY_VERSION
=> "2.4.1"
irb(main):003:0> File.symlink('c:\temp\del.me', 'c:\temp\del2.me')
Errno::EACCES: Permission denied @ rb_file_s_symlink - (c:\temp\del.me, c:\temp\del2.me)
        from (irb):3:in `symlink'
        from (irb):3
        from c:/languages/ruby/Ruby24-x64/bin/irb.cmd:19:in `<main>'

An admin:

irb(main):001:0> File.symlink('c:\temp\del.me', 'c:\temp\del2.me')
=> 0

JRuby (admin)

C:\languages>java -jar jruby-complete-9.1.10.0.jar -Sjirb
irb(main):001:0> File.symlink('c:\temp\del.me', 'c:\temp\del3.me')
NotImplementedError: symlink unsupported or native support failed to load; see http://wiki.jruby.org/Native-Libraries
        from org/jruby/RubyFile.java:1090:in `symlink'
        from (irb):1:in `<eval>'
        from org/jruby/RubyKernel.java:1000:in `eval'
        from org/jruby/RubyKernel.java:1298:in `loop'
        from org/jruby/RubyKernel.java:1120:in `catch'
        from org/jruby/RubyKernel.java:1120:in `catch'
        from uri:classloader:/META-INF/jruby.home/bin/jirb:13:in `<main>'

Currently, the react on rails gem needs this method to work during asset compilation. This means my maven build cannot complete on a windows machine.

This was originally found on 9.1.8, and may be related to:

Environment

Provide at least:

  • JRuby version (jruby -v) and command line (flags, JRUBY_OPTS, etc)
  • Operating system and platform (e.g. uname -a)

Other relevant info you may wish to add:

  • Installed or activated gems
  • Application/framework version (e.g. Rails, Sinatra)
  • Environment variables

Expected Behavior

  • Describe your expectation of how JRuby should behave, perhaps by showing how CRuby/MRI behaves.
  • Provide an executable Ruby script or a link to an example repository.

Actual Behavior

  • Describe or show the actual behavior.
  • Provide text or screen capture showing the behavior.
@cshupp1
Copy link
Author

cshupp1 commented Jun 14, 2017

#3905

@cshupp1
Copy link
Author

cshupp1 commented Jun 14, 2017

I forgot to mention that it does work on a mac. I assume it will on Unix, but I haven't merged my branch down yet to verify.

@cshupp1
Copy link
Author

cshupp1 commented Jun 14, 2017

Thanks. You guys are fast...

@enebo
Copy link
Member

enebo commented Jun 14, 2017

Pretty interesting bug as it turns out. JRuby has not changed since 9.1.2.0 implemented this feature but it appears FFI used to search all ffi_libs in a module to bind to a function. At some point this ended up only using the last specified ffi_lib and failing if it was not on it. The caveat to that behavior if is the function is on libc it will load regardless as to whether it is listed in ffi_lib (e.g. it is special).

@enebo
Copy link
Member

enebo commented Jun 14, 2017

@cshupp1 well I had made 9.1.11.0 and had nearly finished the release and when I saw this come in I decided this should get fixed; so your timing was pretty lucky!

@cshupp1
Copy link
Author

cshupp1 commented Jun 14, 2017

If that releases today too, I am gonna brag pretty hard on JRuby at today's team meeting...

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

2 participants