Bug #3925: setting Tempfile/StringIO to $std* before startup causes
[BUG] Segmentation fault
http://redmine.ruby-lang.org/issues/show/3925
e$B5/I<<Te(B: Akio T.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
e$B%+%F%4%je(B: core, Target version: 1.9.x
ruby -v: ruby 1.9.2p0 (2010-08-18 revision 29036) [i386-mswin32_100]
$stdout, in,
erre$B$Ke(BTempfilee$B$de(BStringIOe$B$r%;%C%H$9$k%i%$%V%i%j$re(B-re$B$GFI$_9~$`$He(B[BUG]e$B$H$J$j$^$9!#e(B
e$BNc!Ke(B
#d.rb
require ‘stringio’
$stdout = StringIO.new
#---------------------------------
e$B$r:n$C$Fe(B
$ruby -r./d -e ‘puts “hello”’
-e: [BUG] Segmentation fault
ruby 1.9.2p0 (2010-08-18 revision 29036) [i386-mswin32_100]
– control frame ----------
c:0001 p:0000 s:0002 b:0002 l:00122c d:00122c TOP
e$B0J2<$N%Q%C%A$G>/$J$/$H$be(BTempfilee$B$O5_$($^$9!#e(BStringIOe$B$K$D$$$F$Oe(Bset_encodinge$B$,L5$$$N$GL5M}$G$9$,!#e(B
— io.c.org Sat Jul 24 19:38:33 2010
+++ io.c Mon Oct 11 03:47:30 2010
@@ -8652,9 +8652,9 @@ rb_stdio_set_default_encoding(void)
extern VALUE rb_stdin, rb_stdout, rb_stderr;
VALUE val = Qnil;
- rb_io_set_encoding(1, &val, rb_stdin);
- rb_io_set_encoding(1, &val, rb_stdout);
- rb_io_set_encoding(1, &val, rb_stderr);
- rb_funcall3(rb_stdin, rb_intern(“set_encoding”), 1, &val);
- rb_funcall3(rb_stdout, rb_intern(“set_encoding”), 1, &val);
- rb_funcall3(rb_stderr, rb_intern(“set_encoding”), 1, &val);
}
/*
-re$B$GFI$9~$`$H<+F0E*$K%G%P%C%,IU$->uBV$GF0$/!J%?!<%2%C%H$Ke(Brequiree$B$rKd$a9~$$?$/$J$$!K%i%$%V%i%j$r3+H/$7$F$$$F5$$E$-$^$7$?!#e(B