From 1fae154c07b957278fd336b54256d5c57f21e0d5 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 23 Jan 2019 06:06:47 +0000 Subject: 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 --- test/test_tmpdir.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/test_tmpdir.rb') diff --git a/test/test_tmpdir.rb b/test/test_tmpdir.rb index eba94056e4..1e633d233b 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 -- cgit v1.2.3