Skip to content

File.stat.writable? returning false in JRuby, true in MRI #5641

@duncan-bayne

Description

@duncan-bayne

Environment

  • jruby 9.1.7.0 (2.3.1) 2017-01-11 68056ae OpenJDK 64-Bit Server VM 25.192-b26 on 1.8.0_192-b26 +jit [freebsd-x86_64]
  • FreeBSD x220 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC amd64

Expected Behavior

I expect JRuby and MRI Ruby to return the same value - true - when File.stat.writable? is run on a writable directory (/tmp).

Actual Behavior

JRuby returns false, where MRI returns true:

➜  ~ ls -lad /tmp
drwxrwxrwt  21 root  wheel  1024  4 Mar 09:43 /tmp
➜  ~ RBENV_VERSION=2.5.1 irb
irb(main):001:0> File.stat('/tmp').writable?
=> true
➜  ~ ls -lad /tmp
drwxrwxrwt  21 root  wheel  1024  4 Mar 09:43 /tmp
➜  ~ RBENV_VERSION=jruby-9.1.7.0 irb
irb(main):001:0> File.stat('/tmp').writable?
=> false

This is causing many failures, including an inability to install Gems, because Dir::tmpdir is failing to find a writable tmpdir.

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