Issue #5850 has been updated by Tomoyuki Chikanaga.


GC ???????? test_autoclose ???????? IO ?????????????????????????????????????????????????????????????????????????????????????????????

test_copy_stream ??? Error ??以??????????????Tempfile#_close ??? File#close ?????(Errno::EBADF)?????????????????????? finalizer ??渡?????????????(@data[1])??? nil ?????????????????????????????????????????????????? @data ??????????????? Tempfile ??? finalizer ????? close ????????????????????????????????????????????????????????? unlink ???? typo ????????????????????????以??????????修正??????????????????????

?????? finalizer ?????????????????????????????????中????????波????????????正????????????????????? ?????????????????????? finalizer ??中???????????????????????????????????????????????????????????????????????????????????????????????????

diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index 3321116..b7c2f91 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -162,9 +162,9 @@ class Tempfile < DelegateClass(File)
   end
 
   def _close    # :nodoc:
+    @data[1] = nil if @data
     @tmpfile.close if @tmpfile
     @tmpfile = nil
-    @data[1] = nil if @data
   end
   protected :_close
 
@@ -231,7 +231,7 @@ class Tempfile < DelegateClass(File)
         File.unlink(@tmpname)
       end
       # remove tmpname from remover
-      @data[0] = @data[2] = nil
+      @data[0] = @data[1] = nil
       @tmpname = nil
     rescue Errno::EACCES
       # may not be able to unlink on Windows; just ignore

----------------------------------------
Bug #5850: Failure test/ruby/test_io.rb
https://bugs.ruby-lang.org/issues/5850

Author: Ayumu AIZAWA
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-01-06 trunk 34219) [x86_64-darwin10.8.0] 


=begin
r34219??? test/ruby/test_io.rb ???1件失??????1件??????????????
????????-j ????????????????????失???????????????????????????????

 0:ruby ???  make test-all TESTS=test/ruby/test_io.rb
 ./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems" test/ruby/test_io.rb
 Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems"
 
 # Running tests:
 
 .F.............E..................................................................................................
 
 Finished tests in 4.242426s, 26.8714 tests/s, 134.3571 assertions/s.
 
 1) Failure:
 test_autoclose(TestIO) [/Users/ayumin/github/ruby/test/ruby/test_io.rb:1444]:
 Errno::EBADF expected but nothing was raised.
 
 2) Error:
 test_copy_stream(TestIO):
 Errno::EBADF: Bad file descriptor
 /Users/ayumin/github/ruby/test/ruby/test_io.rb:32:in `close'
 /Users/ayumin/github/ruby/test/ruby/test_io.rb:32:in `rescue in block in pipe'
 /Users/ayumin/github/ruby/test/ruby/test_io.rb:29:in `block in pipe'
 
 114 tests, 570 assertions, 1 failures, 1 errors, 0 skips
 
 ruby -v: ruby 2.0.0dev (2012-01-06 trunk 34219) [x86_64-darwin10.8.0]
 make: *** [yes-test-all] Error 2
 0:ruby ???  make test-all TESTS='-j 2 test/ruby/test_io.rb'
 ./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems" -j 2 test/ruby/test_io.rb
 Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems" -j 2
 
 # Running tests:
 
 .F.............E..................................................................................................
 Retrying...
 
 .F................................................................................................................
 
 
 
 Finished tests in 10.072929s, 11.3175 tests/s, 56.5873 assertions/s.
 
 1) Failure:
 test_autoclose(TestIO) [/Users/ayumin/github/ruby/test/ruby/test_io.rb:1444]:
 Errno::EBADF expected but nothing was raised.
 
 114 tests, 570 assertions, 1 failures, 0 errors, 0 skips
 
 ruby -v: ruby 2.0.0dev (2012-01-06 trunk 34219) [x86_64-darwin10.8.0]
 make: *** [yes-test-all] Error 1
 
=end



-- 
http://bugs.ruby-lang.org/