summaryrefslogtreecommitdiff
path: root/test/test_tmpdir.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-23 06:06:47 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-23 06:06:47 +0000
commit1fae154c07b957278fd336b54256d5c57f21e0d5 (patch)
tree6a1aab276535839e78c22d1e8729b0007813d8c2 /test/test_tmpdir.rb
parent05c3256b2883000aab033737ef121a96b8009b81 (diff)
tmpdir.rb: permission of user given directory
* lib/tmpdir.rb (Dir.mktmpdir): check if the permission of the parent directory only when using the default temporary directory, and no check against user given directory. the security is the user's responsibility in that case. [ruby-core:91216] [Bug #15555] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_tmpdir.rb')
-rw-r--r--test/test_tmpdir.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/test_tmpdir.rb b/test/test_tmpdir.rb
index eba9405..1e633d2 100644
--- a/test/test_tmpdir.rb
+++ b/test/test_tmpdir.rb
@@ -33,6 +33,12 @@ class TestTmpdir < Test::Unit::TestCase
assert_equal(tmpdir, Dir.tmpdir)
File.chmod(0777, tmpdir)
assert_not_equal(tmpdir, Dir.tmpdir)
+ newdir = Dir.mktmpdir("d", tmpdir) do |dir|
+ assert_file.directory? dir
+ assert_equal(tmpdir, File.dirname(dir))
+ dir
+ end
+ assert_file.not_exist?(newdir)
File.chmod(01777, tmpdir)
assert_equal(tmpdir, Dir.tmpdir)
ensure