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

Failed to execute FileUtils.mkdir_p #7

Open
slide opened this issue Jul 14, 2016 · 0 comments
Open

Failed to execute FileUtils.mkdir_p #7

slide opened this issue Jul 14, 2016 · 0 comments

Comments

@slide
Copy link
Contributor

slide commented Jul 14, 2016

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

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

Copied from original issue: IronLanguages/main#112

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

1 participant