summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-06 09:24:18 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-06 09:24:18 +0000
commitad10b43f7f3a56dd77708416a6cf5b2f16d07325 (patch)
tree2aa3f3cd8bace17da290233660ba4e91b7b728d7 /test
parentcccbcd174b6ccc352a4d8ae919a8090b4423297a (diff)
re-patched r50599 because of test failure on TravisCI.
[Backport #14060] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@64649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_file.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb
index 215d579cc5..b2d85ae81e 100644
--- a/test/ruby/test_file.rb
+++ b/test/ruby/test_file.rb
@@ -294,16 +294,19 @@ class TestFile < Test::Unit::TestCase
def test_realpath_taintedness
Dir.mktmpdir('rubytest-realpath') {|tmpdir|
- realdir = File.realpath(tmpdir)
- assert_predicate(realdir, :tainted?)
- dir, base = File.split(realdir)
+ dir = File.realpath(tmpdir).untaint
+ File.write(File.join(dir, base = "test.file"), '')
+ base.taint
+ dir.taint
assert_predicate(File.realpath(base, dir), :tainted?)
base.untaint
+ dir.taint
assert_predicate(File.realpath(base, dir), :tainted?)
base.taint
dir.untaint
assert_predicate(File.realpath(base, dir), :tainted?)
base.untaint
+ dir.untaint
assert_not_predicate(File.realpath(base, dir), :tainted?)
assert_predicate(Dir.chdir(dir) {File.realpath(base)}, :tainted?)
}