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

jruby 9000 FreeBSD TestFileUtils#test_chmod_symbol_mode fails #2792

Open
bgalbrecht opened this issue Apr 2, 2015 · 6 comments
Open

jruby 9000 FreeBSD TestFileUtils#test_chmod_symbol_mode fails #2792

bgalbrecht opened this issue Apr 2, 2015 · 6 comments

Comments

@bgalbrecht
Copy link

After building jruby 9000 on FreeBSD 10.1 release, when running
bin/jruby -S rake test:mri

I get the following error:
[2287/6445] TestFileUtils#test_chmod_symbol_mode = 0.01 s

  1. Error:
    TestFileUtils#test_chmod_symbol_mode:
    SystemCallError: Unknown error - No message available
    org/jruby/RubyFile.java:581:in chmod' /usr/home/bruce/jruby-dev/jruby/lib/ruby/stdlib/fileutils.rb:1354:inchmod'
    /usr/home/bruce/jruby-dev/jruby/lib/ruby/stdlib/fileutils.rb:1009:in block in chmod' org/jruby/RubyArray.java:1570:ineach'
    /usr/home/bruce/jruby-dev/jruby/lib/ruby/stdlib/fileutils.rb:1008:in chmod' /usr/home/bruce/jruby-dev/jruby/test/mri/fileutils/test_fileutils.rb:1001:intest_chmod_symbol_mode'
@bgalbrecht
Copy link
Author

bin/jruby -v
jruby 9.0.0.0-SNAPSHOT (2.2.1) 2015-04-01 dc85f30 OpenJDK 64-Bit Server VM 24.76-b04 on 1.7.0_76-b13 +jit [FreeBSD-amd64]

@headius
Copy link
Member

headius commented Apr 2, 2015

I don't have a FreeBSD instance handy. Can you run this again with -Xbacktrace.style=raw and gist the result? We do use native calls to chmod...perhaps this is another case of FreeBSD having it in an unusual library?

@bgalbrecht
Copy link
Author

https://gist.github.com/bgalbrecht/d0e9c7d1a475089f2646

chmod is in libc and the api is:
#include <sys/stat.h>

 int
 chmod(const char *path, mode_t mode);

 int
 fchmod(int fd, mode_t mode);

 int
 lchmod(const char *path, mode_t mode);

 int
 fchmodat(int fd, const char *path, mode_t mode, int flag);

where mode_t is defined as an unsigned 16 bit integer:
/usr/include/sys/_types.h:typedef __uint16_t __mode_t;

@headius
Copy link
Member

headius commented Apr 9, 2015

Ahh well if mode_t is 16-bit uint that could explain it. jnr-posix, through which we call chmod, currently uses a 32-bit signed int (Java int) for the signature.

@headius
Copy link
Member

headius commented Apr 9, 2015

Hmm... well we do have a test for fchmod in jnr-posix and that appears to be passing just fine.

@headius
Copy link
Member

headius commented May 5, 2015

If you would like to help move this along, a test for jnr-posix's chmod would help us determine if the problem is there or in JRuby's use of jnr-posix's chmod.

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

2 participants