1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/tmpdir.rb (Dir.tmpdir): should not use world-writable but

non-sticky directory.
* lib/tmpdir.rb (Dir.mktmpdir): check the parent directory.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-03-11 22:19:06 +00:00
parent 42437780d6
commit bcb9e567c4
3 changed files with 34 additions and 2 deletions

20
test/test_tmpdir.rb Normal file
View file

@ -0,0 +1,20 @@
require 'test/unit'
require 'tmpdir'
class TestTmpdir < Test::Unit::TestCase
def test_world_writable
Dir.mktmpdir do |tmpdir|
# ToDo: fix for parallel test
olddir, ENV["TMPDIR"] = ENV["TMPDIR"], tmpdir
begin
assert_equal(tmpdir, Dir.tmpdir)
File.chmod(0777, tmpdir)
assert_not_equal(tmpdir, Dir.tmpdir)
File.chmod(01777, tmpdir)
assert_equal(tmpdir, Dir.tmpdir)
ensure
ENV["TMPDIR"] = olddir
end
end
end
end