ruby-changes:31411
From: usa <ko1@a...>
Date: Thu, 31 Oct 2013 23:44:46 +0900 (JST)
Subject: [ruby-changes:31411] usa:r43490 (ruby_1_9_3): merge revision(s) 43110, 43155: [Backport #8768]
usa 2013-10-31 23:44:40 +0900 (Thu, 31 Oct 2013) New Revision: 43490 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43490 Log: merge revision(s) 43110,43155: [Backport #8768] * lib/tempfile.rb (Tempfile#unlink): finalizer is no longer needed after unlinking. patched by by normalperson (Eric Wong) at [ruby-core:56521] [Bug #8768] Modified directories: branches/ruby_1_9_3/ Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/lib/tempfile.rb branches/ruby_1_9_3/test/test_tempfile.rb branches/ruby_1_9_3/version.h Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 43489) +++ ruby_1_9_3/ChangeLog (revision 43490) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1 +Thu Oct 31 23:42:39 2013 Nobuyoshi Nakada <nobu@r...> + + * lib/tempfile.rb (Tempfile#unlink): finalizer is no longer needed + after unlinking. patched by by normalperson (Eric Wong) at + [ruby-core:56521] [Bug #8768] + Thu Oct 31 23:40:43 2013 Zachary Scott <e@z...> * lib/gserver.rb: [DOC] correct gserver.rb license [Bug #8913] Index: ruby_1_9_3/lib/tempfile.rb =================================================================== --- ruby_1_9_3/lib/tempfile.rb (revision 43489) +++ ruby_1_9_3/lib/tempfile.rb (revision 43490) @@ -190,7 +190,6 @@ class Tempfile < DelegateClass(File) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/lib/tempfile.rb#L190 def close! _close unlink - ObjectSpace.undefine_finalizer(self) end # Unlinks (deletes) the file from the filesystem. One should always unlink @@ -238,6 +237,7 @@ class Tempfile < DelegateClass(File) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/lib/tempfile.rb#L237 # remove tmpname from remover @data[0] = @data[1] = nil @tmpname = nil + ObjectSpace.undefine_finalizer(self) end alias delete unlink Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 43489) +++ ruby_1_9_3/version.h (revision 43490) @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1 #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 478 +#define RUBY_PATCHLEVEL 479 #define RUBY_RELEASE_DATE "2013-10-31" #define RUBY_RELEASE_YEAR 2013 Index: ruby_1_9_3/test/test_tempfile.rb =================================================================== --- ruby_1_9_3/test/test_tempfile.rb (revision 43489) +++ ruby_1_9_3/test/test_tempfile.rb (revision 43490) @@ -206,6 +206,21 @@ puts Tempfile.new('foo').path https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/test_tempfile.rb#L206 end end + def test_tempfile_finalizer_does_not_run_if_unlinked + bug8768 = '[ruby-core:56521] [Bug #8768]' + args = %w(--disable-gems -rtempfile) + assert_in_out_err(args, <<-'EOS') do |(filename), (error)| + tmp = Tempfile.new('foo') + puts tmp.path + tmp.close + tmp.unlink + $DEBUG = true + EOS + refute File.exist?(filename) + assert_nil(error, "#{bug8768} we used to get a confusing 'removing ...done' here") + end + end + def test_size_flushes_buffer_before_determining_file_size t = tempfile("foo") t.write("hello") Property changes on: ruby_1_9_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r43110,43155 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/