mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
merge revision(s) 2ecfb88ee5
: [Backport #16918]
Correctly remove temporary directory if path yielded is mutated Another approach would be to freeze the string, but that could cause backwards compatibility issues. Fixes [Bug #16918]
This commit is contained in:
parent
cc39480cf9
commit
13d2ab0d88
3 changed files with 13 additions and 2 deletions
|
@ -86,7 +86,7 @@ class Dir
|
|||
}
|
||||
if block_given?
|
||||
begin
|
||||
yield path
|
||||
yield path.dup
|
||||
ensure
|
||||
unless base
|
||||
stat = File.stat(File.dirname(path))
|
||||
|
|
|
@ -52,6 +52,17 @@ class TestTmpdir < Test::Unit::TestCase
|
|||
}
|
||||
end
|
||||
|
||||
def test_mktmpdir_mutate
|
||||
bug16918 = '[ruby-core:98563]'
|
||||
assert_nothing_raised(bug16918) do
|
||||
assert_mktmpdir_traversal do |traversal_path|
|
||||
Dir.mktmpdir(traversal_path + 'foo') do |actual|
|
||||
actual << "foo"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_mktmpdir_traversal
|
||||
assert_mktmpdir_traversal do |traversal_path|
|
||||
Dir.mktmpdir(traversal_path + 'foo') do |actual|
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||
#define RUBY_VERSION_TEENY 1
|
||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||
#define RUBY_PATCHLEVEL 98
|
||||
#define RUBY_PATCHLEVEL 99
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2020
|
||||
#define RUBY_RELEASE_MONTH 7
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue