diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-17 05:29:51 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-17 05:29:51 +0000 |
commit | bbf440c90b036c733729b1a5c996978ac2adaa9d (patch) | |
tree | 63a68dca7be09eb7be8a1d5e9c58bb5726688ee9 /test | |
parent | 3759dfa23e6d6106d93a5c9bf845b0fc620a2512 (diff) | |
download | ruby-bbf440c90b036c733729b1a5c996978ac2adaa9d.tar.gz |
* include/ruby/ruby.h: $SAFE=3 is now obsolete.
* ext/socket/init.c, ext/socket/socket.c, ext/socket/tcpsocket.c
ext/socket/udpsocket.c, gc.c, object.c, re.c, safe.c: removed code
for $SAFE=3
* bootstraptest/test_method.rb, test/erb/test_erb.rb, test/ruby/test_dir.rb
test/ruby/test_file.rb, test/ruby/test_method.rb, test/ruby/test_regexp.rb
test/ruby/test_thread.rb: remove tests for $SAFE=3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/erb/test_erb.rb | 7 | ||||
-rw-r--r-- | test/ruby/test_dir.rb | 17 | ||||
-rw-r--r-- | test/ruby/test_file.rb | 6 | ||||
-rw-r--r-- | test/ruby/test_method.rb | 13 | ||||
-rw-r--r-- | test/ruby/test_regexp.rb | 13 | ||||
-rw-r--r-- | test/ruby/test_thread.rb | 4 |
6 files changed, 2 insertions, 58 deletions
diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb index 107ad1a0da..150df1dc26 100644 --- a/test/erb/test_erb.rb +++ b/test/erb/test_erb.rb @@ -90,13 +90,6 @@ class TestERBCore < Test::Unit::TestCase _test_core(0) _test_core(1) _test_core(2) - orig = $VERBOSE - begin - $VERBOSE = false - _test_core(3) - ensure - $VERBOSE = orig - end end def _test_core(safe) diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb index 9e92286905..44c9b7c5f7 100644 --- a/test/ruby/test_dir.rb +++ b/test/ruby/test_dir.rb @@ -325,21 +325,4 @@ class TestDir < Test::Unit::TestCase end } end - - def test_insecure_chdir - assert_raise(SecurityError) do - proc do - $SAFE=3 - Dir.chdir("/") - end.call - end - m = "\u{79fb 52d5}" - d = Class.new(Dir) {singleton_class.class_eval {alias_method m, :chdir}} - assert_raise_with_message(SecurityError, /#{m}/) do - proc do - $SAFE=3 - d.__send__(m, "/") - end.call - end - end end diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index a700527a4e..8335b78760 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -409,12 +409,6 @@ class TestFile < Test::Unit::TestCase (0..1).each do |level| assert_nothing_raised(SecurityError, bug5374) {in_safe[level]} end - def (s = Object.new).to_path; "".taint; end - m = "\u{691c 67fb}" - (c = Class.new(File)).singleton_class.class_eval {alias_method m, :stat} - assert_raise_with_message(SecurityError, /#{m}/) { - proc {$SAFE = 3; c.__send__(m, s)}.call - } end if /(bcc|ms|cyg)win|mingw|emx/ =~ RUBY_PLATFORM diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 04042448fc..1cff8318ab 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -879,19 +879,6 @@ class TestMethod < Test::Unit::TestCase assert_equal n , rest_parameter(*(1..n)).size, '[Feature #10440]' end - def test_insecure_method - m = "\u{5371 967a}" - c = Class.new do - proc {$SAFE=3;def foo;end}.call - alias_method m, "foo" - eval "def bar; #{m}; end" - end - obj = c.new - assert_raise_with_message(SecurityError, /#{m}/) do - obj.bar - end - end - class C D = "Const_D" def foo diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index cef21b99aa..a3fdd59738 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -585,19 +585,6 @@ class TestRegexp < Test::Unit::TestCase assert_equal(3, "foobarbaz\u3042".rindex(/b../n, 5)) end - def test_taint - m = Thread.new do - "foo"[/foo/] - $SAFE = 3 - /foo/.match("foo") - end.value - assert_predicate(m, :tainted?) - assert_nothing_raised('[ruby-core:26137]') { - m = proc {$SAFE = 3; %r"#{ }"o}.call - } - assert_predicate(m, :tainted?) - end - def assert_regexp(re, ss, fs = [], msg = nil) re = Regexp.new(re) unless re.is_a?(Regexp) ss = [ss] unless ss.is_a?(Array) diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 0eb57628d3..be8a28a14b 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -389,14 +389,14 @@ class TestThread < Test::Unit::TestCase ok = false t = Thread.new do EnvUtil.suppress_warning do - $SAFE = 3 + $SAFE = 1 end ok = true sleep end Thread.pass until ok assert_equal(0, Thread.current.safe_level) - assert_equal(3, t.safe_level) + assert_equal(1, t.safe_level) ensure t.kill if t |