mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 09:33:59 +02:00
merge revision(s) 70f69f8539
: [Backport #18941]
[ruby/fileutils] Fix mkdir_p hanging on Windows when trying to create
a file on a offline drive
9cc6a082d7
---
lib/fileutils.rb | 2 +-
test/fileutils/test_fileutils.rb | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
This commit is contained in:
parent
89eab8e0bf
commit
a07e7ad6b0
3 changed files with 10 additions and 2 deletions
|
@ -212,7 +212,7 @@ module FileUtils
|
||||||
path = remove_trailing_slash(item)
|
path = remove_trailing_slash(item)
|
||||||
|
|
||||||
stack = []
|
stack = []
|
||||||
until File.directory?(path)
|
until File.directory?(path) || File.dirname(path) == path
|
||||||
stack.push path
|
stack.push path
|
||||||
path = File.dirname(path)
|
path = File.dirname(path)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1098,6 +1098,14 @@ class TestFileUtils < Test::Unit::TestCase
|
||||||
ensure
|
ensure
|
||||||
Dir.rmdir(drive) if drive and File.directory?(drive)
|
Dir.rmdir(drive) if drive and File.directory?(drive)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_mkdir_p_offline_drive
|
||||||
|
offline_drive = ("A".."Z").to_a.reverse.find {|d| !File.exist?("#{d}:/") }
|
||||||
|
|
||||||
|
assert_raise(Errno::ENOENT) {
|
||||||
|
mkdir_p "#{offline_drive}:/new_dir"
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_mkdir_p_file_perm
|
def test_mkdir_p_file_perm
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||||
#define RUBY_VERSION_TEENY 3
|
#define RUBY_VERSION_TEENY 3
|
||||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||||
#define RUBY_PATCHLEVEL 61
|
#define RUBY_PATCHLEVEL 62
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2022
|
#define RUBY_RELEASE_YEAR 2022
|
||||||
#define RUBY_RELEASE_MONTH 9
|
#define RUBY_RELEASE_MONTH 9
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue