diff --git a/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.1.pre/rack/rewindable_input.rb b/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.1.pre/rack/rewindable_input.rb index 2347dc35..2864d510 100644 --- a/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.1.pre/rack/rewindable_input.rb +++ b/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.1.pre/rack/rewindable_input.rb @@ -72,7 +72,7 @@ module Rack # access it because we have the file handle open. @rewindable_io = Tempfile.new('RackRewindableInput') @rewindable_io.chmod(0000) - if filesystem_has_posix_semantics? + if filesystem_has_posix_semantics? && !tempfile_unlink_contains_bug? @rewindable_io.unlink @unlinked = true end @@ -94,5 +94,15 @@ module Rack def filesystem_has_posix_semantics? RUBY_PLATFORM !~ /(mswin|mingw|cygwin|java)/ end + + def tempfile_unlink_contains_bug? + # The tempfile library as included in Ruby 1.9.1-p152 and later + # contains a bug: unlinking an open Tempfile object also closes + # it, which breaks our expected POSIX semantics. This problem + # has been fixed in Ruby 1.9.2, but the Ruby team chose not to + # include the bug fix in later versions of the 1.9.1 series. + ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby" + ruby_engine == "ruby" && RUBY_VERSION == "1.9.1" && RUBY_PATCHLEVEL >= 152 + end end end