summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-25 18:24:28 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-25 18:24:28 +0000
commitacc6a302e4587b58c40f4bf5c5ef6b21ba79c0e2 (patch)
treeafad964232c436f8bf1da20beff3d44dd0215753
parent1bd1e84388f0cb133891d366563bef72796593f8 (diff)
merge revision(s) 57640: [Backport #13214]
fileutils.rb: do not make root * lib/fileutils.rb (FileUtils#mkdir_p): no need to make root directory which should be exist and cannot be made with mkdir recent Cygwin can make a directory contains a colon. [Bug #13214] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-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 932776c847..31b67afd0d 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -221,6 +221,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, options[:mode]
diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb
index 5d029c919c..5c5a2c2ea8 100644
--- a/test/fileutils/test_fileutils.rb
+++ b/test/fileutils/test_fileutils.rb
@@ -895,6 +895,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 f84b120601..ffd6dd3385 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.7"
#define RUBY_RELEASE_DATE "2017-03-26"
-#define RUBY_PATCHLEVEL 452
+#define RUBY_PATCHLEVEL 453
#define RUBY_RELEASE_YEAR 2017
#define RUBY_RELEASE_MONTH 3