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

Closed
duncan-bayne opened this issue Mar 3, 2019 · 6 comments
Closed

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

duncan-bayne opened this issue Mar 3, 2019 · 6 comments
Milestone

Comments

@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
Copy link
Author

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
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
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
@enebo
Copy link
Member

enebo commented Jun 26, 2019

jnr-posix was updated so this is fixed.

@enebo enebo closed this as completed Jun 26, 2019
@Freaky
Copy link
Contributor

Freaky commented Jul 3, 2019

Hmm, just ran a build off latest jruby-master, and I'm not seeing this issue resolved despite it apparently using jnr-posix 3.0.50 which should have my fix.

I'd be expecting it to call out to /bin/freebsd-version to determine the appropriate ABI, but I'm not seeing that with ktrace...

@Freaky
Copy link
Contributor

Freaky commented Jul 4, 2019

Disregard that, I was holding it wrong. Ahem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants