SystemCallError: Unknown error - mkdir failed #4402

frankwong15 opened this Issue Dec 20, 2016 · 4 comments


None yet

3 participants



jruby (2.3.1) 2016-11-09 0150a76 Java HotSpot(TM) 64-Bit Server VM 25.111-b14 on 1.8.0_111-b14 +jit [linux-x86_64]

Linux frank-nb 4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Sample code below:

Expected Behavior

JRuby has access to /tmp according to security policy and it should be able to create folder under /tmp.

Actual Behavior

JRuby raises SystemCallError because it tries to create folder / which it has no access.

SystemCallError: Unknown error - mkdir failed
mkdir at org/jruby/
fu_mkdir at /home/frank/.rvm/rubies/jruby-
block in mkdir_p at /home/frank/.rvm/rubies/jruby-
reverse_each at org/jruby/
block in mkdir_p at /home/frank/.rvm/rubies/jruby-
mkdir_p at /home/frank/.rvm/rubies/jruby-

at -e:1

@frankwong15 frankwong15 added a commit to frankwong15/jruby that referenced this issue Dec 20, 2016
@frankwong15 frankwong15 Fix #4402. Do not create file from root folder 07c26f4

I patched fileutils.rb. Instead of creating the following folders


It only creates

headius commented Jan 6, 2017

This is an interesting case. I assume it doesn't fail if you have no security manager installed?

Your patch to skip already-existing dirs seems simple enough. I'll try it and run some tests here to see what impact it has.

Normally we don't patch the stdlib, since it is intended to match CRuby. In this case, if the patch makes sense and doesn't hurt CRuby, I'll just commit there too.

headius commented Jan 6, 2017

The patch does not appear to impact tests at all, so it seems good. I'd like our friend @nobu to weigh in (along with anyone else from ruby-core that might be interested).

nobu commented Jan 7, 2017

I'm curious what "Unknown error" is, and why it isn't rescued.
The first half seems OK, but I hesitate in the last half as there can be a race condition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment