Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

Failed to execute FileUtils.mkdir_p #112

Closed
wilfrem opened this issue Apr 6, 2013 · 1 comment
Closed

Failed to execute FileUtils.mkdir_p #112

wilfrem opened this issue Apr 6, 2013 · 1 comment

Comments

@wilfrem
Copy link

wilfrem commented Apr 6, 2013

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

$ 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)

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)

@slide
Copy link
Contributor

slide commented Jul 14, 2016

This issue was moved to IronLanguages/ironruby#7

@slide slide closed this as completed Jul 14, 2016
@slide slide removed the untriaged label Aug 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants