Bug #3119: [Patch] "IOError (closed stream)" error with tempfile unlink then close usage
http://redmine.ruby-lang.org/issues/show/3119

Author: Simon Nicholls
Status: Open, Priority: Normal
Category: lib
ruby -v: ruby 1.9.2dev (2010-04-02 trunk 27189) [x86_64-darwin10]

The Tempfile#unlink method clobbers Tempfile's @data variable, which _close needs in order to remove it's reference to the tmpfile correctly.

This means that when the Remover finalizer runs, the (still valid) reference it has to @data is inspected, the tmpfile is found when it shouldn't be, and the tmpfile is closed again to cause the error.

The patch simply removes the @data assignment from the following in unlink:

@data = @tmpname = nil


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