← 输入框|github.com|刷新
Skip to content

File.symlink broken on windows #4669

Closed
Closed

Description

@cshupp1

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.

Activity

  1. cshupp1 commented on Jun 14, 2017

    @cshupp1
    Author
  2. cshupp1 commented on Jun 14, 2017

    @cshupp1
    Author

    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.

  3. added this to the JRuby 9.1.11.0 milestone on Jun 14, 2017
  4. added a commit that references this issue on Jun 14, 2017
    2a9be2f
  5. cshupp1 commented on Jun 14, 2017

    @cshupp1
    Author

    Thanks. You guys are fast...

  6. enebo commented on Jun 14, 2017

    @enebo
    Member

    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).

  7. enebo commented on Jun 14, 2017

    @enebo
    Member

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

  8. cshupp1 commented on Jun 14, 2017

    @cshupp1
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions