When call FileUtils.mkdir_p "/tmp/foo/bar" on condition "/tmp/foo" and "/tmp/foo/bar" not exists, it throws ArgumentError
$ ruby
IronRuby 1.1.3.0 on 3.0.7 (tarball Wed Apr 3 11:21:23 PDT 2013)
Copyright (c) Microsoft Corporation. All rights reserved.
>>> require "fileutils"
=> true
>>> FileUtils.mkdir_p "/tmp/foo/bar"
mscorlib:0:in `GetDirectoryName': Invalid path (ArgumentError)
from /usr/local/ironruby/bin/../lib/ruby/1.9.1/fileutils.rb:245:in `mkdir'
from /usr/local/ironruby/bin/../lib/ruby/1.9.1/fileutils.rb:245:in `fu_mkdir'
from /usr/local/ironruby/bin/../lib/ruby/1.9.1/fileutils.rb:217:in `reverse_each'
from /usr/local/ironruby/bin/../lib/ruby/1.9.1/fileutils.rb:217:in `mkdir_p'
from /usr/local/ironruby/bin/../lib/ruby/1.9.1/fileutils.rb:215:in `each'
from /usr/local/ironruby/bin/../lib/ruby/1.9.1/fileutils.rb:215:in `mkdir_p'
from /usr/local/ironruby/bin/../lib/ruby/1.9.1/fileutils.rb:201:in `mkdir_p'
I found mkdir_p "/tmp/foo/bar/" call fu_mkdir "", fu_mkdir "" call Dir.mkdir "".
But Dir.mkdir "" throws ArgumentError because it calls GetDirectoryName("") (MRI Ruby throws ENOENT extends SystemCallError)
From @wilfrem on April 6, 2013 8:4
Hello.
When I executing rubygems, I find a bug around FileUtils.mkdir_p.
OS: Ubuntu 12.10 C#: mono 3.0.7 $ ruby --version IronRuby 1.1.3.0 on 3.0.7 (tarball Wed Apr 3 11:21:23 PDT 2013)
When call FileUtils.mkdir_p "/tmp/foo/bar" on condition "/tmp/foo" and "/tmp/foo/bar" not exists, it throws ArgumentError
I found mkdir_p "/tmp/foo/bar/" call fu_mkdir "", fu_mkdir "" call Dir.mkdir "". But Dir.mkdir "" throws ArgumentError because it calls GetDirectoryName("") (MRI Ruby throws ENOENT extends SystemCallError)
https://github.com/IronLanguages/main/blob/master/Languages/Ruby/Libraries/Builtins/Dir.cs Line:217
mkdir_p cannot rescue ArgumentError, so it fails. (mkdir_p can rescue SystemCallError, so MRI Ruby can execute it)
Copied from original issue: IronLanguages/main#112