From: Yoshimasa Niwa Date: 2010-10-21T14:44:06+09:00 Subject: [ruby-dev:42439] [Ruby 1.9-Bug#3973][Open] Unexpected error and segmentation fault without close Bug #3973: Unexpected error and segmentation fault without close http://redmine.ruby-lang.org/issues/show/3973 起票者: Yoshimasa Niwa ステータス: Open, 優先度: Normal ruby -v: ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0] Run next small code on ruby 1.9.2p0 shows unexpected TypeError on line 3. while true f = File.open("/dev/null", "w") f.write("a") # => in `
': wrong argument type # (expected Data) (TypeError) end This code doesn't have "f.close" so it's buggy, but it may not raise TypeError. Also, next code causes segmentation fault. require 'net/http' while true Net::HTTP.get(URI.parse("http://localhost/")) f = File.open("/dev/null", "w") f.write("a") end Ruby 1.9.2p0で、closeし忘れのopenがwhileの中にあると、予期しないTypeErrorが発生し、 また場合によってはSegmentation Faultが発生します。 ---------------------------------------- http://redmine.ruby-lang.org