summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/fileutils.rb1
-rw-r--r--test/fileutils/test_fileutils.rb18
-rw-r--r--version.h2
3 files changed, 20 insertions, 1 deletions
diff --git a/lib/fileutils.rb b/lib/fileutils.rb
index 6662b90932..94934233df 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -202,6 +202,7 @@ module FileUtils
stack.push path
path = File.dirname(path)
end
+ stack.pop # root directory should exist
stack.reverse_each do |dir|
begin
fu_mkdir dir, mode
diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb
index 4d790a74bc..0534b1b08e 100644
--- a/test/fileutils/test_fileutils.rb
+++ b/test/fileutils/test_fileutils.rb
@@ -905,6 +905,24 @@ class TestFileUtils < Test::Unit::TestCase
mkdir_p '/'
end
+ if /mswin|mingw|cygwin/ =~ RUBY_PLATFORM
+ def test_mkdir_p_root
+ if /cygwin/ =~ RUBY_PLATFORM
+ tmpdir = `cygpath -ma .`.chomp
+ else
+ tmpdir = Dir.pwd
+ end
+ skip "No drive letter" unless /\A[a-z]:/i =~ tmpdir
+ drive = "./#{$&}"
+ assert_file_not_exist drive
+ mkdir_p "#{tmpdir}/none/dir"
+ assert_directory "none/dir"
+ assert_file_not_exist drive
+ ensure
+ Dir.rmdir(drive) if drive and File.directory?(drive)
+ end
+ end
+
def test_mkdir_p_file_perm
mkdir_p 'tmp/tmp/tmp', :mode => 07777
assert_directory 'tmp/tmp/tmp'
diff --git a/version.h b/version.h
index 11a6cb9b01..145e1302db 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.4.2"
#define RUBY_RELEASE_DATE "2017-05-09"
-#define RUBY_PATCHLEVEL 125
+#define RUBY_PATCHLEVEL 126
#define RUBY_RELEASE_YEAR 2017
#define RUBY_RELEASE_MONTH 5