Skip to content

JRuby raises IOError instead of specific error if File.rename(a,b) fails due to hidden filesystem #5318

@bgalbrecht

Description

@bgalbrecht

Environment

jruby -v
jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.172-b11 on 1.8.0_172-b11 +jit [freebsd-x86_64]
FreeBSD jrails5.zuhause.org 11.1-RELEASE-p9 FreeBSD 11.1-RELEASE-p9 #0: Tue Apr  3 16:59:16 UTC 2018     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

This is running in a FreeBSD jail where /tmp is a tmpfs file system, current path is in /home, which is under the root filesystem, and enforce.statfs=2 flag is set for the jail, so Files.getFileStore fails with Mount point not found in fstab if one or both paths are within /tmp. This difference causes bundler to fail.

Expected Behavior

jrails5% ls -ld /tmp/junk1
dr-xr-xr-x  2 bruce  wheel  0 Sep 20 23:49 /tmp/junk1/
jrails5% rbenv version
2.5.1 (set by /home/bruce/.ruby-version)
jrails5% irb
irb(main):001:0> File.rename('/tmp/zxc', 'asdx')
Traceback (most recent call last):
        3: from /home/bruce/.rbenv/versions/2.5.1/bin/irb:11:in `<main>'
        2: from (irb):1
        1: from (irb):1:in `rename'
Errno::EXDEV (Cross-device link @ rb_file_s_rename - (/tmp/zxc, asdx))
irb(main):002:0> File.rename('/tmp/zxc','/tmp/junk1/asd')
Traceback (most recent call last):
        3: from /home/bruce/.rbenv/versions/2.5.1/bin/irb:11:in `<main>'
        2: from (irb):2
        1: from (irb):2:in `rename'
Errno::EACCES (Permission denied @ rb_file_s_rename - (/tmp/zxc, /tmp/junk1/asd))
irb(main):003:0> 

Actual Behavior

jrails5% irb
irb(main):001:0> File.rename('/tmp/zxc', 'asdx')
Traceback (most recent call last):
        7: from /home/bruce/.rbenv/versions/jruby-9.2.0.0/bin/irb:13:in `<main>'
        6: from org/jruby/RubyKernel.java:1180:in `catch'
        5: from org/jruby/RubyKernel.java:1180:in `catch'
        4: from org/jruby/RubyKernel.java:1418:in `loop'
        3: from org/jruby/RubyKernel.java:1037:in `eval'
        2: from (irb):1:in `<eval>'
        1: from org/jruby/RubyFile.java:1097:in `rename'
IOError (Mount point not found in fstab)
irb(main):002:0> File.rename('/tmp/zxc','/tmp/junk1/asd')
Traceback (most recent call last):
        7: from /home/bruce/.rbenv/versions/jruby-9.2.0.0/bin/irb:13:in `<main>'
        6: from org/jruby/RubyKernel.java:1180:in `catch'
        5: from org/jruby/RubyKernel.java:1180:in `catch'
        4: from org/jruby/RubyKernel.java:1418:in `loop'
        3: from org/jruby/RubyKernel.java:1037:in `eval'
        2: from (irb):2:in `<eval>'
        1: from org/jruby/RubyFile.java:1097:in `rename'
IOError (Mount point not found in fstab)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions