ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:39000] [Ruby 1.9 - Bug #5199][Open] ext/tk: RB_GC_GUARD seems to be needed in several places
@ 2011-08-17  2:31 Eric Wong
  2011-08-18  6:54 ` [ruby-core:39016] [Ruby 1.9 - Bug #5199] " Kenta Murata
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Eric Wong @ 2011-08-17  2:31 UTC (permalink / raw
  To: ruby-core


Issue #5199 has been reported by Eric Wong.

----------------------------------------
Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places
http://redmine.ruby-lang.org/issues/5199

Author: Eric Wong
Status: Open
Priority: Normal
Assignee: 
Category: ext
Target version: 1.9.x
ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux]


I noticed the following in ext/tk/tkutil/tkutil.c:

    rb_warning("fail to convert '%s' to string for Tk",
                   RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0,
                   0)));

    id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));

I don't use or know the Tk ext at all, but the above examples do not
appear safe from a GC perspective.  Compilers can optimize the original
VALUE away entirely so GC can collect.

RSTRING_PTR (being a macro,) may also evaluate its arguments multiple
times.



-- 
http://redmine.ruby-lang.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:39016] [Ruby 1.9 - Bug #5199] ext/tk: RB_GC_GUARD seems to be needed in several places
  2011-08-17  2:31 [ruby-core:39000] [Ruby 1.9 - Bug #5199][Open] ext/tk: RB_GC_GUARD seems to be needed in several places Eric Wong
@ 2011-08-18  6:54 ` Kenta Murata
  2013-02-17 10:06 ` [ruby-core:52367] [ruby-trunk " ko1 (Koichi Sasada)
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Kenta Murata @ 2011-08-18  6:54 UTC (permalink / raw
  To: ruby-core


Issue #5199 has been updated by Kenta Murata.

Assignee set to Hidetoshi Nagai


----------------------------------------
Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places
http://redmine.ruby-lang.org/issues/5199

Author: Eric Wong
Status: Open
Priority: Normal
Assignee: Hidetoshi Nagai
Category: ext
Target version: 1.9.x
ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux]


I noticed the following in ext/tk/tkutil/tkutil.c:

    rb_warning("fail to convert '%s' to string for Tk",
                   RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0,
                   0)));

    id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));

I don't use or know the Tk ext at all, but the above examples do not
appear safe from a GC perspective.  Compilers can optimize the original
VALUE away entirely so GC can collect.

RSTRING_PTR (being a macro,) may also evaluate its arguments multiple
times.



-- 
http://redmine.ruby-lang.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:52367] [ruby-trunk - Bug #5199] ext/tk: RB_GC_GUARD seems to be needed in several places
  2011-08-17  2:31 [ruby-core:39000] [Ruby 1.9 - Bug #5199][Open] ext/tk: RB_GC_GUARD seems to be needed in several places Eric Wong
  2011-08-18  6:54 ` [ruby-core:39016] [Ruby 1.9 - Bug #5199] " Kenta Murata
@ 2013-02-17 10:06 ` ko1 (Koichi Sasada)
  2013-02-18  4:51   ` [ruby-core:52432] " Hidetoshi NAGAI
  2013-02-20  3:54 ` [ruby-core:52553] " nobu (Nobuyoshi Nakada)
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: ko1 (Koichi Sasada) @ 2013-02-17 10:06 UTC (permalink / raw
  To: ruby-core


Issue #5199 has been updated by ko1 (Koichi Sasada).

Target version changed from 2.0.0 to 2.1.0

Time up for 2.0.0.

Nagai-san, how about it?
----------------------------------------
Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places
https://bugs.ruby-lang.org/issues/5199#change-36417

Author: normalperson (Eric Wong)
Status: Assigned
Priority: Normal
Assignee: nagai (Hidetoshi Nagai)
Category: ext
Target version: 2.1.0
ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux]


I noticed the following in ext/tk/tkutil/tkutil.c:

    rb_warning("fail to convert '%s' to string for Tk",
                   RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0,
                   0)));

    id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));

I don't use or know the Tk ext at all, but the above examples do not
appear safe from a GC perspective.  Compilers can optimize the original
VALUE away entirely so GC can collect.

RSTRING_PTR (being a macro,) may also evaluate its arguments multiple
times.



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:52432] Re: [ruby-trunk - Bug #5199] ext/tk: RB_GC_GUARD seems to be needed in several places
  2013-02-17 10:06 ` [ruby-core:52367] [ruby-trunk " ko1 (Koichi Sasada)
@ 2013-02-18  4:51   ` Hidetoshi NAGAI
  0 siblings, 0 replies; 9+ messages in thread
From: Hidetoshi NAGAI @ 2013-02-18  4:51 UTC (permalink / raw
  To: ruby-core

From: "ko1 (Koichi Sasada)" <redmine@ruby-lang.org>
Subject: [ruby-core:52367] [ruby-trunk - Bug #5199] ext/tk: RB_GC_GUARD seems to be needed in several places
Date: Sun, 17 Feb 2013 19:06:43 +0900
Message-ID: <redmine.journal-36417.20130217190643@ruby-lang.org>

> Issue #5199 has been updated by ko1 (Koichi Sasada).
> 
> Target version changed from 2.0.0 to 2.1.0
> 
> Time up for 2.0.0.
> 
> Nagai-san, how about it?

I'm very sorry. I didn't check the tickets about Ruby/Tk.
Last half year (and now), I was busy on my primary works.
So I couldn't follow up many changes for 2.0.0.
I'll fix them on 2.1.0 as soon as possible.
Although I'm sorry, it's not now. Maybe, it is one month or more after.
-- 
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
Department of Artificial Intelligence, Kyushu Institute of Technology

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:52553] [ruby-trunk - Bug #5199] ext/tk: RB_GC_GUARD seems to be needed in several places
  2011-08-17  2:31 [ruby-core:39000] [Ruby 1.9 - Bug #5199][Open] ext/tk: RB_GC_GUARD seems to be needed in several places Eric Wong
  2011-08-18  6:54 ` [ruby-core:39016] [Ruby 1.9 - Bug #5199] " Kenta Murata
  2013-02-17 10:06 ` [ruby-core:52367] [ruby-trunk " ko1 (Koichi Sasada)
@ 2013-02-20  3:54 ` nobu (Nobuyoshi Nakada)
  2013-02-21  3:31 ` [ruby-core:52608] " jonforums (Jon Forums)
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-02-20  3:54 UTC (permalink / raw
  To: ruby-core


Issue #5199 has been updated by nobu (Nobuyoshi Nakada).

File bug-5199-tkutil.diff added

Quick patch.

2.0 has GC safe functions, rb_sprintf() with PRIsVALUE, rb_intern_str(), and so on.
----------------------------------------
Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places
https://bugs.ruby-lang.org/issues/5199#change-36641

Author: normalperson (Eric Wong)
Status: Assigned
Priority: Normal
Assignee: nagai (Hidetoshi Nagai)
Category: ext
Target version: 2.1.0
ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux]


I noticed the following in ext/tk/tkutil/tkutil.c:

    rb_warning("fail to convert '%s' to string for Tk",
                   RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0,
                   0)));

    id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));

I don't use or know the Tk ext at all, but the above examples do not
appear safe from a GC perspective.  Compilers can optimize the original
VALUE away entirely so GC can collect.

RSTRING_PTR (being a macro,) may also evaluate its arguments multiple
times.



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:52608] [ruby-trunk - Bug #5199] ext/tk: RB_GC_GUARD seems to be needed in several places
  2011-08-17  2:31 [ruby-core:39000] [Ruby 1.9 - Bug #5199][Open] ext/tk: RB_GC_GUARD seems to be needed in several places Eric Wong
                   ` (2 preceding siblings ...)
  2013-02-20  3:54 ` [ruby-core:52553] " nobu (Nobuyoshi Nakada)
@ 2013-02-21  3:31 ` jonforums (Jon Forums)
  2013-06-17  5:20 ` [ruby-core:55524] " nagai (Hidetoshi Nagai)
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: jonforums (Jon Forums) @ 2013-02-21  3:31 UTC (permalink / raw
  To: ruby-core


Issue #5199 has been updated by jonforums (Jon Forums).


nobu (Nobuyoshi Nakada) wrote:
> Quick patch.
> 
> 2.0 has GC safe functions, rb_sprintf() with PRIsVALUE, rb_intern_str(), and so on.

Does a list of these new 2.0 GC-safe functions exist anywhere?

If the 2.0 GC-safe functions aren't currently enumerated in a single, accessible place, should they be listed in a new section to README.EXT, and a short note added to mame-san's draft 2.0.0-p0 ANN? Perhaps under "Built-in libraries" as "New GC-safe API for more robust extensions."
----------------------------------------
Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places
https://bugs.ruby-lang.org/issues/5199#change-36695

Author: normalperson (Eric Wong)
Status: Assigned
Priority: Normal
Assignee: nagai (Hidetoshi Nagai)
Category: ext
Target version: 2.1.0
ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux]


I noticed the following in ext/tk/tkutil/tkutil.c:

    rb_warning("fail to convert '%s' to string for Tk",
                   RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0,
                   0)));

    id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));

I don't use or know the Tk ext at all, but the above examples do not
appear safe from a GC perspective.  Compilers can optimize the original
VALUE away entirely so GC can collect.

RSTRING_PTR (being a macro,) may also evaluate its arguments multiple
times.



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:55524] [ruby-trunk - Bug #5199] ext/tk: RB_GC_GUARD seems to be needed in several places
  2011-08-17  2:31 [ruby-core:39000] [Ruby 1.9 - Bug #5199][Open] ext/tk: RB_GC_GUARD seems to be needed in several places Eric Wong
                   ` (3 preceding siblings ...)
  2013-02-21  3:31 ` [ruby-core:52608] " jonforums (Jon Forums)
@ 2013-06-17  5:20 ` nagai (Hidetoshi Nagai)
  2013-06-17  8:10 ` [ruby-core:55526] " nobu (Nobuyoshi Nakada)
  2014-01-12  6:31 ` [ruby-core:59701] " Tomoyuki, Chikanaga
  6 siblings, 0 replies; 9+ messages in thread
From: nagai (Hidetoshi Nagai) @ 2013-06-17  5:20 UTC (permalink / raw
  To: ruby-core


Issue #5199 has been updated by nagai (Hidetoshi Nagai).


nobu (Nobuyoshi Nakada) wrote: 
> Quick patch. 
> 
> 2.0 has GC safe functions, rb_sprintf() with PRIsVALUE, rb_intern_str(), and so on.

Nakada-san, please commit the patch.

----------------------------------------
Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places
https://bugs.ruby-lang.org/issues/5199#change-39990

Author: normalperson (Eric Wong)
Status: Assigned
Priority: Normal
Assignee: nagai (Hidetoshi Nagai)
Category: ext
Target version: current: 2.1.0
ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux]
Backport: 


I noticed the following in ext/tk/tkutil/tkutil.c:

    rb_warning("fail to convert '%s' to string for Tk",
                   RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0,
                   0)));

    id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));

I don't use or know the Tk ext at all, but the above examples do not
appear safe from a GC perspective.  Compilers can optimize the original
VALUE away entirely so GC can collect.

RSTRING_PTR (being a macro,) may also evaluate its arguments multiple
times.



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:55526] [ruby-trunk - Bug #5199] ext/tk: RB_GC_GUARD seems to be needed in several places
  2011-08-17  2:31 [ruby-core:39000] [Ruby 1.9 - Bug #5199][Open] ext/tk: RB_GC_GUARD seems to be needed in several places Eric Wong
                   ` (4 preceding siblings ...)
  2013-06-17  5:20 ` [ruby-core:55524] " nagai (Hidetoshi Nagai)
@ 2013-06-17  8:10 ` nobu (Nobuyoshi Nakada)
  2014-01-12  6:31 ` [ruby-core:59701] " Tomoyuki, Chikanaga
  6 siblings, 0 replies; 9+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-06-17  8:10 UTC (permalink / raw
  To: ruby-core


Issue #5199 has been updated by nobu (Nobuyoshi Nakada).

Backport set to 2.0.0: REQUIRED


----------------------------------------
Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places
https://bugs.ruby-lang.org/issues/5199#change-39994

Author: normalperson (Eric Wong)
Status: Closed
Priority: Normal
Assignee: nagai (Hidetoshi Nagai)
Category: ext
Target version: current: 2.1.0
ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux]
Backport: 2.0.0: REQUIRED


I noticed the following in ext/tk/tkutil/tkutil.c:

    rb_warning("fail to convert '%s' to string for Tk",
                   RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0,
                   0)));

    id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));

I don't use or know the Tk ext at all, but the above examples do not
appear safe from a GC perspective.  Compilers can optimize the original
VALUE away entirely so GC can collect.

RSTRING_PTR (being a macro,) may also evaluate its arguments multiple
times.



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:59701] [ruby-trunk - Bug #5199] ext/tk: RB_GC_GUARD seems to be needed in several places
  2011-08-17  2:31 [ruby-core:39000] [Ruby 1.9 - Bug #5199][Open] ext/tk: RB_GC_GUARD seems to be needed in several places Eric Wong
                   ` (5 preceding siblings ...)
  2013-06-17  8:10 ` [ruby-core:55526] " nobu (Nobuyoshi Nakada)
@ 2014-01-12  6:31 ` Tomoyuki, Chikanaga
  6 siblings, 0 replies; 9+ messages in thread
From: Tomoyuki, Chikanaga @ 2014-01-12  6:31 UTC (permalink / raw
  To: ruby-core

チケット #5199 が Tomoyuki Chikanaga によって更新されました。

Backport を 2.0.0: REQUIRED から 2.0.0: DONE に変更

r41351 was backported to ruby_2_0_0 at r44564.

----------------------------------------
Bug #5199: ext/tk: RB_GC_GUARD seems to be needed in several places
https://bugs.ruby-lang.org/issues/5199#change-44218

* 作成者: Eric Wong
* ステータス: Closed
* 優先度: Normal
* 担当者: Hidetoshi Nagai
* カテゴリ: ext
* 対象バージョン: 2.1.0
* ruby -v: ruby 1.9.4dev (2011-08-11 trunk 32931) [x86_64-linux]
* Backport: 2.0.0: DONE
----------------------------------------
I noticed the following in ext/tk/tkutil/tkutil.c:

    rb_warning("fail to convert '%s' to string for Tk",
                   RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0,
                   0)));

    id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));

I don't use or know the Tk ext at all, but the above examples do not
appear safe from a GC perspective.  Compilers can optimize the original
VALUE away entirely so GC can collect.

RSTRING_PTR (being a macro,) may also evaluate its arguments multiple
times.


---ファイル---------------------------------
bug-5199-tkutil.diff (3.833 KB)


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-01-12  6:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-17  2:31 [ruby-core:39000] [Ruby 1.9 - Bug #5199][Open] ext/tk: RB_GC_GUARD seems to be needed in several places Eric Wong
2011-08-18  6:54 ` [ruby-core:39016] [Ruby 1.9 - Bug #5199] " Kenta Murata
2013-02-17 10:06 ` [ruby-core:52367] [ruby-trunk " ko1 (Koichi Sasada)
2013-02-18  4:51   ` [ruby-core:52432] " Hidetoshi NAGAI
2013-02-20  3:54 ` [ruby-core:52553] " nobu (Nobuyoshi Nakada)
2013-02-21  3:31 ` [ruby-core:52608] " jonforums (Jon Forums)
2013-06-17  5:20 ` [ruby-core:55524] " nagai (Hidetoshi Nagai)
2013-06-17  8:10 ` [ruby-core:55526] " nobu (Nobuyoshi Nakada)
2014-01-12  6:31 ` [ruby-core:59701] " Tomoyuki, Chikanaga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).