1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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_3@58180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2017-03-27 16:57:39 +00:00
parent e3a295cd50
commit 0dc5e45028
3 changed files with 20 additions and 1 deletions

View file

@ -222,6 +222,7 @@ module FileUtils
stack.push path stack.push path
path = File.dirname(path) path = File.dirname(path)
end end
stack.pop # root directory should exist
stack.reverse_each do |dir| stack.reverse_each do |dir|
begin begin
fu_mkdir dir, options[:mode] fu_mkdir dir, options[:mode]

View file

@ -903,6 +903,24 @@ class TestFileUtils < Test::Unit::TestCase
mkdir_p '/' mkdir_p '/'
end 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 def test_mkdir_p_file_perm
mkdir_p 'tmp/tmp/tmp', :mode => 07777 mkdir_p 'tmp/tmp/tmp', :mode => 07777
assert_directory 'tmp/tmp/tmp' assert_directory 'tmp/tmp/tmp'

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.3.3" #define RUBY_VERSION "2.3.3"
#define RUBY_RELEASE_DATE "2017-03-28" #define RUBY_RELEASE_DATE "2017-03-28"
#define RUBY_PATCHLEVEL 289 #define RUBY_PATCHLEVEL 290
#define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_YEAR 2017
#define RUBY_RELEASE_MONTH 3 #define RUBY_RELEASE_MONTH 3