1.9 coredump

e$BEOJUE/Li$G$9!#e(B

ruby 1.9.0 (2007-05-17 patchlevel 0) [i686-linux]

e$B>e$Ge(B core e$B$7$FMn$A$^$9$N$GJs9p$7$^$9!#e(B


$ ./ruby-1.9.0 -Ke /tmp/j.rb *.c *.h /.c
zsh: 29641 segmentation fault (core dumped) ./ruby-1.9.0 -Ke /tmp/j.rb
*.c *.h /.c

-Ke e$B$O$J$/$F$be(B core e$B$7$^$9!#e(B

gdb e$B$Ne(B backtrace e$B$Oe(B string.c tr_setup_table
e$B$G$G$F$$$k$N$G$9$,!"$I$&$be(B
e$BIT0BDj$N$h$&$G$9!#e(B(string.c tr_setup_table
e$B$=$N$b$N$O0JA0$HF1$8$h$&$Ge(B
e$B$9$N$Ge(B)


#0 0x080a884b in tr_setup_table (str=1080892200, table=0xbf800150
“\200”, init=1) at string.c:3144
3144 tr.p = RSTRING_PTR(str); tr.pend = tr.p + RSTRING_LEN(str);
(gdb) bt
#0 0x080a884b in tr_setup_table (str=1080892200, table=0xbf800150
“\200”, init=1) at string.c:3144
#1 0x080a8d6b in rb_str_count (argc=1, argv=0x40309024, str=1080892240)
at string.c:3384
#2 0x080bd325 in call_cfunc (func=0x80a8d06 <rb_str_count>,
recv=1080892240, len=1080892200, argc=1, argv=0x7) at call_cfunc.ci:36
#3 0x080bb4a4 in th_eval (th=0x814fef0, initial=0) at insns.def:1279
#4 0x080bcc76 in th_eval_body (th=0x814fef0) at vm.c:1620
#5 0x080bd15f in rb_thread_eval (th=0x814fef0, iseqval=1076863380) at
vm.c:1826
#6 0x080be51d in yarvcore_eval_iseq (iseq=1076863380) at yarvcore.c:97
#7 0x080be5ba in yarvcore_eval_parsed (node=0x402fa1d0,
file=1076863420) at yarvcore.c:129
#8 0x08059057 in ruby_exec_internal () at eval.c:210
#9 0x08059087 in ruby_exec () at eval.c:223
#10 0x080590bd in ruby_run () at eval.c:242
#11 0x08056abd in main () at main.c:47
#12 0x400d9c1f in __libc_start_main () from /lib/i686/libc.so.6


#0 0x080a890c in tr_setup_table (str=0, table=0xbf800170 ‘\001’
<repeats 200 times>…, init=1) at string.c:3160
3160 buf[c & 0xff] = !cflag;
(gdb) bt
#0 0x080a890c in tr_setup_table (str=0, table=0xbf800170 ‘\001’
<repeats 200 times>…, init=1) at string.c:3160
#1 0x080a8d6b in rb_str_count (argc=1, argv=0x40309024, str=1080892240)
at string.c:3384
#2 0x080bd325 in call_cfunc (func=0x80a8d06 <rb_str_count>,
recv=1080892240, len=0, argc=1, argv=0x406d1b30) at call_cfunc.ci:36
#3 0x080bb4a4 in th_eval (th=0x814fef0, initial=0) at insns.def:1279
#4 0x080bcc76 in th_eval_body (th=0x814fef0) at vm.c:1620
#5 0x080bd15f in rb_thread_eval (th=0x814fef0, iseqval=1076863380) at
vm.c:1826
#6 0x080be51d in yarvcore_eval_iseq (iseq=1076863380) at yarvcore.c:97
#7 0x080be5ba in yarvcore_eval_parsed (node=0x402fa1d0,
file=1076863420) at yarvcore.c:129
#8 0x08059057 in ruby_exec_internal () at eval.c:210
#9 0x08059087 in ruby_exec () at eval.c:223
#10 0x080590bd in ruby_run () at eval.c:242
#11 0x08056abd in main () at main.c:47
#12 0x400d9c1f in __libc_start_main () from /lib/i686/libc.so.6

e$B:F8=%9%/%j%W%He(B


require ‘nkf’

while gets("\n")
l = $_
break if l.count("\n") > 1
l = NKF.nkf(’-Se’, l)
if l =~ /SIGV/
end
end

e$B:F8=%9%/%j%W%H$N$I$N9T$b:G>.8BI,MW$=$&$G$9!#=hM}NL4X78$G$O$J$$$+e(B?
e$B$H$O;W$&$N$G$9$,!#e(B

e$B:F8=J}K!e(B


$ cd ruby-1.9 e$B7O%=!<%9$N%H%C%We(B
$ ./ruby e$B:F8=%9%/%j%W%He(B *.c *.h /.c

strace e$B$N7k2L$G$O$[$\Kh2se(B win32/win32.c
e$B$G5/$-$F$$$k$h$&$J$N$G$9$,!"C1e(B
e$B=c$K=hM}NL$H;W$o$l$^$9!#e(Bwin32/win32.c
e$B$N%U%!%$%k0l$D$G$O5/$-$^$;$s!#e(B

e$B3NG’$7$?%7%9%F%`$Oe(B


Vine Linux 3.2 glibc-2.3.3-3vl1.3
Vine Linux 4.1 glibc-2.3.4-2vl3

e$B$G$9!#e(B

Ruby
e$B$N%=!<%9%3!<%I%l%Y%k$N$b$N$r07$C$F5$$,IU$$$?$N$G$9$,!"$$$D$4$m$+e(B
e$B$i$+e(B?
e$B$H$$$&$N$O$O$C$-$j$7$^$;$s!#IaCJ$+$i;H$C$F$$$k%9%/%j%W%H$G5/$-$?e(B
e$B$N$G$9$,!“07$&NL$K0MB8$7$F$$$k$h$&$J$N$G!”$O$C$-$j$7$^$;$s$G$9!#$9$$$^e(B
e$B$;$s!#e(B

e$BEOJUE/Li$G$9!#e(B

In message “[ruby-dev:30791] 1.9 coredump”
on 07/05/18, WATANABE Tetsuya writes:

|ruby 1.9.0 (2007-05-17 patchlevel 0) [i686-linux]
|
|e$B>e$Ge(B core e$B$7$FMn$A$^$9$N$GJs9p$7$^$9!#e(B

e$B$N7o$G$9$,!"%9%?%C%/%5%$%:$NJQ99$GBP1~e(B(e$B2sHre(B)e$B$G$-$k$h$&$J$N$G$*e(B
e$BCN$i$;$7$^$9!#e(Bcore
e$B$N>r7o$H$7$F07$&%U%!%$%kNL$,4X78$7$F$$$^$7e(B
e$B$?!#e(B


e$B%9%?%C%/%*!<%P!<%U%m!<$N%O%s%I%j%s%0e(B(Stack Overflow Handling)
スタックオーバーフローのハンドリング (Stack Overflow Handling)

e$B$rFI$s$G$$$?$N$G$9$,!“%9%?%C%/%5%$%:$rG!”;0G$K$9$k$3$H$G07$&e(B
e$B%U%!%$%kNL$rA}$d$7$F$be(B core e$B$7$J$/$J$k$3$H$,3NG’$G$-$^$7$?!#e(B

e$B3NG’$7$?%7%9%F%`$Oe(B Vine Linux 4.1 e$B$K$J$j$^$9!#%G%U%)%k%H$G$Oe(B
8MB e$B$G$9!#e(B


$ ulimit -s
8192

core e$B$9$k>l9g$K$O%9%?%C%/%5%$%:$rA}$d$9$3$H$,M-8z$N$h$&$G$9!#e(B

e$B0J2<$Oe(B core e$B$7$?>l9g$Ke(B ulimit -s
e$B$G%9%?%C%/%5%$%:$rA}$d$7$Fe(B
core e$B$r2sHr$7$?7P2a$G$9!#e(Bruby 1.9
e$B$N%=!<%9%3!<%I$G;n$7$F$$$^$9!#e(B


$ rg.rb SIGV *.c
zsh: 16153 segmentation fault rg.rb SIGV *.c

$ ulimit -s 16384
$ rg.rb SIGV *.c
signal.c:#ifdef SIGVTALRM
signal.c: {“VTALRM”, SIGVTALRM},
signal.c: sigdelset(&mask, SIGVTALRM);
signal.c: if (sig == SIGVTALRM) {
signal.c: rb_raise(rb_eArgError, “SIGVTALRM reserved for Thread;
can’t set handler”);
rg.rb SIGV *.c 1.88s user 1.31s system 97% cpu 3.255 total

$ rg.rb SIGV *.c *.h /.c
signal.c:#ifdef SIGVTALRM
signal.c: {“VTALRM”, SIGVTALRM},
signal.c: sigdelset(&mask, SIGVTALRM);
signal.c: if (sig == SIGVTALRM) {
signal.c: rb_raise(rb_eArgError, “SIGVTALRM reserved for Thread;
can’t set handler”);
zsh: 16164 segmentation fault rg.rb SIGV *.c *.h /.c

$ ulimit -s 24576
$ rg.rb SIGV *.c *.h /.c
signal.c:#ifdef SIGVTALRM
signal.c: {“VTALRM”, SIGVTALRM},
signal.c: sigdelset(&mask, SIGVTALRM);
signal.c: if (sig == SIGVTALRM) {
signal.c: rb_raise(rb_eArgError, “SIGVTALRM reserved for Thread;
can’t set handler”);
rg.rb SIGV *.c *.h /.c 1.82s user 1.70s system 98% cpu 3.567 total

e$B!!$5$5$@$G$9!%e(B

WATANABE Tetsuya wrote:

スタックオーバーフローのハンドリング (Stack Overflow Handling)
8192

core e$B$9$k>l9g$K$O%9%?%C%/%5%$%:$rA}$d$9$3$H$,M-8z$N$h$&$G$9!#e(B

e$B0J2<$Oe(B core e$B$7$?>l9g$Ke(B ulimit -s e$B$G%9%?%C%/%5%$%:$rA}$d$7$Fe(B
core e$B$r2sHr$7$?7P2a$G$9!#e(Bruby 1.9 e$B$N%=!<%9%3!<%I$G;n$7$F$$$^$9!#e(B

e$B!!8=>u$Ne(B 1.8
e$B$G$b!$%^%7%s%9%?%C%/$“$U$l$O87L)$K$O%A%'%C%/$G$-$F$$$J$$$He(B
e$B;W$&$N$G$9$,!$e(B1.9
e$B$G$O$5$i$K4E$$!$$H$$$&46$8$G$7$g$&$+!%3N$+$K$”$s$^$je(B
e$B%A%'%C%/$7$F$J$$$+$b$7$l$^$;$s!%e(B

e$B!!$7$+$7!$$3$NNc$@$H!$%^%7%s%9%?%C%/$O$"$^$j?<$/$J$i$J$$$h$&$J5$$,$9$k$se(B
e$B$G$9$,!$$J$s$Ge(BSEGVe$B$K$J$k$s$G$7$g$&$+!%$&!<$s!%e(B

e$BEOJUE/Li$G$9!#e(B

ruby 1.9 trunk rev 12411 e$B$K$F!“8=>]$,5/$-$Je(B
e$B$/$J$C$?$3$H$r3NG’$7$^$7$?!#e(Bstack size e$B$b%Ge(B
e$B%U%)%k%H$Ne(B 8192k e$B$GLdBj$”$j$^$;$s$G$7$?!#e(B

e$B$"$j$,$H$&$4$6$$$^$9!#e(B

In message “[ruby-dev:30791] 1.9 coredump”
on 07/05/18, WATANABE Tetsuya e$B$5$se(B writes:

|e$BEOJUE/Li$G$9!#e(B
|
|ruby 1.9.0 (2007-05-17 patchlevel 0) [i686-linux]
|
|e$B>e$Ge(B core e$B$7$FMn$A$^$9$N$GJs9p$7$^$9!#e(B

$ ./ruby-1.9.0 -Ke /tmp/j.rb *.c *.h /.c
zsh: 29641 segmentation fault (core dumped) ./ruby-1.9.0 -Ke /tmp/j.rb *.c *.h /.c
------------------------------