[#36672] [Bug #616] instance_eval and Module#to_s — Shyouhei Urabe <redmine@...>

Bug #616: instance_eval and Module#to_s

12 messages 2008/10/06

[#36750] [Bug #650] Marshal.load raises RegexpError — Shyouhei Urabe <redmine@...>

Bug #650: Marshal.load raises RegexpError

30 messages 2008/10/15
[#36769] Re: [Bug #650] Marshal.load raises RegexpError — Yukihiro Matsumoto <matz@...> 2008/10/17

まつもと ゆきひろです

[#36771] Re: [Bug #650] Marshal.load raises RegexpError — Urabe Shyouhei <shyouhei@...> 2008/10/17

卜部です。

[#36772] Re: [Bug #650] Marshal.load raises RegexpError — Yukihiro Matsumoto <matz@...> 2008/10/17

まつもと ゆきひろです

[#36773] Re: [Bug #650] Marshal.load raises RegexpError — Urabe Shyouhei <shyouhei@...> 2008/10/17

卜部です。

[#36784] Re: [Bug #650] Marshal.load raises RegexpError — Yukihiro Matsumoto <matz@...> 2008/10/18

まつもと ゆきひろです

[#36785] Re: [Bug #650] Marshal.load raises RegexpError — Urabe Shyouhei <shyouhei@...> 2008/10/18

卜部です。

[#36793] Re: [Bug #650] Marshal.load raises RegexpError — Yukihiro Matsumoto <matz@...> 2008/10/19

まつもと ゆきひろです

[#36794] Re: [Bug #650] Marshal.load raises RegexpError — Urabe Shyouhei <shyouhei@...> 2008/10/19

Yukihiro Matsumoto さんは書きました:

[#36823] Re: [Bug #650] Marshal.load raises RegexpError — Yukihiro Matsumoto <matz@...> 2008/10/21

まつもと ゆきひろです

[#36830] Re: [Bug #650] Marshal.load raises RegexpError — Urabe Shyouhei <shyouhei@...> 2008/10/21

もとの正規表現にバグがあるのは認めますが、それに巻き込まれてでかいPStore

[#36833] Re: [Bug #650] Marshal.load raises RegexpError — Yukihiro Matsumoto <matz@...> 2008/10/21

まつもと ゆきひろです

[#36764] Re: [ruby-cvs:27036] Ruby:r19818 (trunk): * transcode.c (str_transcode0): String#encode without argument now — Martin Duerst <duerst@...>

まつもとさん、こんばんは。

11 messages 2008/10/17
[#36767] Re: [ruby-cvs:27036] Ruby:r19818 (trunk): * transcode.c (str_transcode0): String#encode without argument now — Yukihiro Matsumoto <matz@...> 2008/10/17

まつもと ゆきひろです

[#36799] Re: [ruby-cvs:27036] Ruby:r19818 (trunk): * transcode.c (str_transcode0): String#encode without argument now — Martin Duerst <duerst@...> 2008/10/20

まつもとさん、こんにちは。

[#36774] ConverterNotFoundError while making Ruby in Windows(trunk) — Masaki Suketa <masaki.suketa@...>

助田です。

13 messages 2008/10/17
[#36797] Re: ConverterNotFoundError while making Ruby in Windows(trunk) — "U.Nakamura" <usa@...> 2008/10/20

こんにちは、なかむら(う)です。

[#36800] Re: ConverterNotFoundError while making Ruby in Windows(trunk) — "U.Nakamura" <usa@...> 2008/10/20

こんにちは、なかむら(う)です。

[#36789] [Bug #660] 数字を3桁ずつコンマで区切るsprintf書式指定 — "rubikitch ." <redmine@...>

Bug #660: 数字を3桁ずつコンマで区切るsprintf書式指定

13 messages 2008/10/19

[#37007] [Bug:1.9] 1+1+1+...+1 dumps core — "Yusuke ENDOH" <mame@...>

遠藤です。

13 messages 2008/10/31

[ruby-dev:36712] abort in rescue

From: "Yusuke ENDOH" <mame@...>
Date: 2008-10-13 08:41:24 UTC
List: ruby-dev #36712
遠藤です。

1.8 では rescue の中で abort するとスタックトレースを出すようですが、
1.9 では何も表示されなくなっています。


$ ruby18 -e 'begin; raise; rescue; abort; end'
-e:1: unhandled exception

$ ruby19 -e 'begin; raise; rescue; abort; end'


rb_f_abort を見るとスタックトレースを出そうとするコードが残っており、
意図的な挙動変更には見えませんでした。

スタックトレースを出すようにするのは簡単ですが、1.9 では $! = nil が
禁止されているため、この挙動を抑止する方法がありません。


$ ruby18 -e 'begin; raise; rescue; $! = nil; abort; end'

$ ruby19 -e 'begin; raise; rescue; $! = nil; abort; end'
-e:1:in `rescue in <main>': $! is a read-only variable (NameError)
        from -e:1:in `<main>'


どうしたもんでしょうか。
以下はスタックトレースを出すようにし、$! への代入を許可するように
するパッチです。


Index: eval.c
===================================================================
--- eval.c	(revision 19769)
+++ eval.c	(working copy)
@@ -426,7 +426,7 @@
     rb_raise(rb_eInterrupt, "%s", "");
 }

-static VALUE get_errinfo(void);
+VALUE get_errinfo(void);

 /*
  *  call-seq:
@@ -953,7 +953,7 @@
     return 0;
 }

-static VALUE
+VALUE
 get_errinfo(void)
 {
     VALUE *ptr = errinfo_place();
@@ -971,7 +971,6 @@
     return get_errinfo();
 }

-#if 0
 static void
 errinfo_setter(VALUE val, ID id, VALUE *var)
 {
@@ -988,7 +987,6 @@
 	}
     }
 }
-#endif

 VALUE
 rb_errinfo(void)
@@ -1119,7 +1117,7 @@
 Init_eval(void)
 {
     rb_define_virtual_variable("$@", errat_getter, errat_setter);
-    rb_define_virtual_variable("$!", errinfo_getter, 0);
+    rb_define_virtual_variable("$!", errinfo_getter, errinfo_setter);

     rb_define_global_function("iterator?", rb_f_block_given_p, 0);
     rb_define_global_function("block_given?", rb_f_block_given_p, 0);
Index: process.c
===================================================================
--- process.c	(revision 19769)
+++ process.c	(working copy)
@@ -2534,10 +2534,12 @@
 rb_f_abort(int argc, VALUE *argv)
 {
     extern void ruby_error_print(void);
+    extern VALUE get_errinfo(void);

     rb_secure(4);
     if (argc == 0) {
-	if (!NIL_P(GET_THREAD()->errinfo)) {
+	VALUE errinfo = GET_THREAD()->errinfo = get_errinfo();
+	if (!NIL_P(errinfo)) {
 	    ruby_error_print();
 	}
 	rb_exit(EXIT_FAILURE);

-- 
Yusuke ENDOH <mame@tsg.ne.jp>

In This Thread

Prev Next