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.stat.writable? returning false in JRuby, true in MRI #5641

Open
duncan-bayne opened this Issue Mar 3, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@duncan-bayne
Copy link

duncan-bayne commented Mar 3, 2019

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.

@duncan-bayne

This comment has been minimized.

Copy link
Author

duncan-bayne commented Mar 4, 2019

truss suggests the call to fstatat is returning the correct permissions:

fstatat(AT_FDCWD,"/tmp",{ mode=drwxrwxrwt ,inode=15328896,size=1024,blksize=32768 },0x0) = 0 (0x0)
@Freaky

This comment has been minimized.

Copy link
Contributor

Freaky commented Mar 4, 2019

See #5521 - until jnr/jnr-posix#126 is fixed, you'll want to run JRuby under an 11.2 chroot or jail so it sees the old stat structure.

@headius

This comment has been minimized.

Copy link
Member

headius commented Apr 9, 2019

@Freaky Sorry that jnr/jnr-posix#126 got left behind. Let's get it merged and fix this!

@headius headius modified the milestones: JRuby 9.1.18.0, JRuby 9.2.8.0 Apr 9, 2019

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.