aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2020-07-23 11:16:31 +0900
committernagachika <nagachika@ruby-lang.org>2020-07-23 11:16:31 +0900
commit13d2ab0d88bbf72ed310efaec6edc46dd96fdb4d (patch)
treeadc31b2d36e636e9e977ba9007a05a39aff0d341 /test
parentcc39480cf9f2767967b6bcc69ccb3c201e5b2231 (diff)
downloadruby-13d2ab0d88bbf72ed310efaec6edc46dd96fdb4d.tar.gz
merge revision(s) 2ecfb88ee50510955acd3ae9fc94a5f109e7f109: [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]
Diffstat (limited to 'test')
-rw-r--r--test/test_tmpdir.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_tmpdir.rb b/test/test_tmpdir.rb
index c599dcf516..50583b5ce1 100644
--- a/test/test_tmpdir.rb
+++ b/test/test_tmpdir.rb
@@ -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|