ruby-changes:29217
From: shugo <ko1@a...>
Date: Thu, 13 Jun 2013 11:01:55 +0900 (JST)
Subject: [ruby-changes:29217] shugo:r41269 (trunk): * bootstraptest/test_autoload.rb, bootstraptest/test_method.rb:
shugo 2013-06-13 11:01:42 +0900 (Thu, 13 Jun 2013) New Revision: 41269 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41269 Log: * bootstraptest/test_autoload.rb, bootstraptest/test_method.rb: remove tests for $SAFE=4. * lib/pp.rb: use taint instead of untrust to avoid warnings when $VERBOSE is set to true. Modified files: trunk/ChangeLog trunk/bootstraptest/test_autoload.rb trunk/bootstraptest/test_method.rb trunk/lib/pp.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 41268) +++ ChangeLog (revision 41269) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jun 13 10:47:16 2013 Shugo Maeda <shugo@r...> + + * bootstraptest/test_autoload.rb, bootstraptest/test_method.rb: + remove tests for $SAFE=4. + + * lib/pp.rb: use taint instead of untrust to avoid warnings when + $VERBOSE is set to true. + Thu Jun 13 06:12:18 2013 Tanaka Akira <akr@f...> * bignum.c (integer_unpack_num_bdigits_small): Fix a compile error on Index: bootstraptest/test_method.rb =================================================================== --- bootstraptest/test_method.rb (revision 41268) +++ bootstraptest/test_method.rb (revision 41269) @@ -886,50 +886,6 @@ class C0; def m *args; [:C0_m, args]; en https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_method.rb#L886 class C1 < C0; def m a, o=:o; super; end; end ; C1.new.m 1, 2} -assert_equal %q{[:ok, :ok, :ok, :ok, :ok, :ok, :ng, :ng]}, %q{ - $ans = [] - class Foo - def m - end - end - - c1 = c2 = nil - - lambda{ - $SAFE = 4 - c1 = Class.new{ - def m - end - } - c2 = Class.new(Foo){ - alias mm m - } - }.call - - def test - begin - yield - rescue SecurityError - $ans << :ok - else - $ans << :ng - end - end - - o1 = c1.new - o2 = c2.new - - test{o1.m} - test{o2.mm} - test{o1.send :m} - test{o2.send :mm} - test{o1.public_send :m} - test{o2.public_send :mm} - test{o1.method(:m).call} - test{o2.method(:mm).call} - $ans -} - assert_equal 'ok', %q{ class C def x=(n) Index: bootstraptest/test_autoload.rb =================================================================== --- bootstraptest/test_autoload.rb (revision 41268) +++ bootstraptest/test_autoload.rb (revision 41269) @@ -43,46 +43,6 @@ assert_equal 'ok', %q{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_autoload.rb#L43 ZZZ.ok } -assert_equal 'ok', %q{ - open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"} - autoload :ZZZ, "./zzz.rb" - proc{$SAFE=4; ZZZ.ok}.call -} - -assert_equal 'ok', %q{ - open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"} - autoload :ZZZ, "./zzz.rb" - require "./zzz.rb" - proc{$SAFE=4; ZZZ.ok}.call -} - -assert_equal 'ok', %q{ - open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"} - autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb') - module M; end - Thread.new{M.instance_eval('$SAFE=4; ZZZ.new.hoge')}.value -} - -assert_equal 'ok', %q{ - open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"} - autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb') - module M; end - Thread.new{$SAFE=4; M.instance_eval('ZZZ.new.hoge')}.value -} - -assert_equal 'ok', %q{ - open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"} - autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb') - Thread.new{$SAFE=4; eval('ZZZ.new.hoge')}.value -} - -assert_equal 'ok', %q{ - open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"} - autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb') - module M; end - Thread.new{eval('$SAFE=4; ZZZ.new.hoge')}.value -} - assert_equal 'okok', %q{ open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"} autoload :ZZZ, "./zzz.rb" Index: lib/pp.rb =================================================================== --- lib/pp.rb (revision 41268) +++ lib/pp.rb (revision 41269) @@ -132,17 +132,17 @@ class PP < PrettyPrint https://github.com/ruby/ruby/blob/trunk/lib/pp.rb#L132 # and preserves the previous set of objects being printed. def guard_inspect_key if Thread.current[:__recursive_key__] == nil - Thread.current[:__recursive_key__] = {}.untrust + Thread.current[:__recursive_key__] = {}.taint end if Thread.current[:__recursive_key__][:inspect] == nil - Thread.current[:__recursive_key__][:inspect] = {}.untrust + Thread.current[:__recursive_key__][:inspect] = {}.taint end save = Thread.current[:__recursive_key__][:inspect] begin - Thread.current[:__recursive_key__][:inspect] = {}.untrust + Thread.current[:__recursive_key__][:inspect] = {}.taint yield ensure Thread.current[:__recursive_key__][:inspect] = save -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/