[#44586] [Ruby 1.9 - Bug #5423][Open] readlineの入力待機中に端末のウィンドウサイズ変更すると入力内容が乱れる — Takuto Matsuu <matsuu@...>

8 messages 2011/10/08

[#44589] [Ruby 1.9 - Bug #5429][Open] 64ビットなFreeBSDのioctlでビット31が1なリクエストの時の不具合 — Makoto Kishimoto <redmine@...>

21 messages 2011/10/09

[#44604] Ruby 2.0 release plan — "NARUSE, Yui" <naruse@...>

ささださんが既にいくつか 2.0 関連のメールを投げていらっしゃいますが、

75 messages 2011/10/18
[#44612] Re: Ruby 2.0 release plan — Yusuke Endoh <mame@...> 2011/10/18

遠藤です。

[#44607] Re: Ruby 2.0 release plan — Yukihiro Matsumoto <matz@...> 2011/10/18

まつもと ゆきひろです

[#44618] Re: Ruby 2.0 release plan — "NARUSE, Yui" <naruse@...> 2011/10/18

(2011/10/18 16:15), Yukihiro Matsumoto wrote:

[#44619] Re: Ruby 2.0 release plan — Yukihiro Matsumoto <matz@...> 2011/10/18

まつもと ゆきひろです

[#44627] Re: Ruby 2.0 release plan — Urabe Shyouhei <shyouhei@...> 2011/10/19

On 10/18/2011 10:16 PM, Yukihiro Matsumoto wrote:

[#44629] Re: Ruby 2.0 release plan — Yukihiro Matsumoto <matz@...> 2011/10/19

まつもと ゆきひろです

[#44631] Re: Ruby 2.0 release plan — Urabe Shyouhei <shyouhei@...> 2011/10/19

たとえば2.0の次のバージョン番号はどうしますか?

[#44633] Re: Ruby 2.0 release plan — "NARUSE, Yui" <naruse@...> 2011/10/20

2011年10月20日3:31 Urabe Shyouhei <shyouhei@ruby-lang.org>:

[#44707] [ruby-trunk - Feature #5512][Open] Integer#/ の改訂 — tadayoshi funaba <redmine@...>

13 messages 2011/10/30

[#44719] [ruby-trunk - Feature #5520][Open] Numeric#exact?、Numeric#inexact? の追加 — tadayoshi funaba <redmine@...>

13 messages 2011/10/31

[ruby-dev:44690] Re: [ruby-trunk - Bug #5475][Open] r33507以降SolarisでPTYが使えない

From: Tanaka Akira <akr@...>
Date: 2011-10-24 09:43:39 UTC
List: ruby-dev #44690
2011年10月24日16:56 Naohisa Goto <ngotogenome@gmail.com>:

> Bug #5475: r33507以降SolarisでPTYが使えない
> http://redmine.ruby-lang.org/issues/5475

> デバッガで追ってみると、ext/pty/pty.c:296 の grantpt(masterfd) が -1 となり、
> errno は EACCES (Solaris10では13) でした。
> そして、r33507で新規に導入された ext/pty/pty.c:294 の rb_fd_set_cloexec(masterfd); で masterfd に FD_CLOEXEC フラグを設定しているのが原因のようです。
>
> Solarisでは、grantpt(3) 内部で /usr/lib/pt_chmod という setuid root されたヘルパープログラムを呼んでデバイスファイルのパーミッション設定を行っていますが、FD_CLOEXECをptyのmasterfdに設定すると、ヘルパープログラムを呼ぶ際に自動でcloseされてしまうため、ヘルパープログラムにclose済みのファイルデスクリプタが渡され、エラーになるのだろうと推測します。

なるほど。

とりあえずワークアランドとして以下のようにすると避けられるでしょうか。

そのうち Solaris の grandpt() が FD_CLOEXEC をつけてあっても動くように
変わるんじゃないかという気もしますが。

Index: ext/pty/pty.c
===================================================================
--- ext/pty/pty.c	(revision 33517)
+++ ext/pty/pty.c	(working copy)
@@ -290,10 +290,18 @@ get_device_once(int *master, int *slave,
     dfl.sa_flags = 0;
     sigemptyset(&dfl.sa_mask);

+#if defined(sun)
+    /* Solaris 10 needs FD_CLOEXEC bit clear to work with grantpt().
[ruby-dev:44688] */
+    if ((masterfd = posix_openpt(O_RDWR|O_NOCTTY)) == -1) goto error;
+    if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error;
+    if (grantpt(masterfd) == -1) goto grantpt_error;
+    rb_fd_set_cloexec(masterfd);
+#else
     if ((masterfd = posix_openpt(O_RDWR|O_NOCTTY)) == -1) goto error;
     rb_fd_set_cloexec(masterfd);
     if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error;
     if (grantpt(masterfd) == -1) goto grantpt_error;
+#endif
     if (sigaction(SIGCHLD, &old, NULL) == -1) goto error;
     if (unlockpt(masterfd) == -1) goto error;
     if ((slavedevice = ptsname(masterfd)) == NULL) goto error;
-- 
[田中 哲][たなか あきら][Tanaka Akira]

In This Thread