[#35333] [Ruby 1.8 - Bug #221] (Open) Net::SMTPでSMTPのHELO/EHLOにデフォルトで不正なホスト名を使用 — Anonymous <redmine@...>

チケット #221 が報告されました。 (by Anonymous)

31 messages 2008/07/03
[#35521] [Ruby 1.8 - Bug #221] Net::SMTPでSMTPのHELO/EHLOにデフォルトで不正なホスト名を使用 — Anonymous <redmine@...> 2008/07/15

チケット #221 が更新されました。 (by Anonymous)

[#35522] Re: [Ruby 1.8 - Bug #221] Net::SMTPでSMTPのHELO/EHLOにデフォルトで不正なホスト名を使用 — とみたまさひろ <tommy@...> 2008/07/15

とみたです。

[#35527] Re: [Ruby 1.8 - Bug #221] Net::SMTPでSMTPのHELO/EHLOにデフォルトで不正なホスト名を使用 — とみたまさひろ <tommy@...> 2008/07/16

とみたです。

[#35537] Re: [Ruby 1.8 - Bug #221] Net::SMTPでSMTPのHELO/EHLOにデフォルトで不正なホスト名を使用 — Urabe Shyouhei <shyouhei@...> 2008/07/16

卜部です。

[#35355] リリース前ToDoリスト — Yukihiro Matsumoto <matz@...>

まつもと ゆきひろです

42 messages 2008/07/04
[#35365] Re: リリース前ToDoリスト — Nobuyoshi Nakada <nobu@...> 2008/07/04

なかだです。

[#35366] Re: リリース前ToDoリスト — Yukihiro Matsumoto <matz@...> 2008/07/04

まつもと ゆきひろです

[#35464] Re: リリース前ToDoリスト — Takao Kouji <kouji@...7.net> 2008/07/13

高尾宏治です。

[#35514] Re: リリース前ToDoリスト — Takao Kouji <kouji@...7.net> 2008/07/15

高尾宏治です。

[#35515] Re: リリース前ToDoリスト — Nobuyoshi Nakada <nobu@...> 2008/07/15

なかだです。

[#35519] Re: リリース前ToDoリスト — Takao Kouji <kouji@...7.net> 2008/07/15

高尾宏治です。

[#35523] Re: リリース前ToDoリスト — Nobuyoshi Nakada <nobu@...> 2008/07/16

なかだです。

[#35528] Re: リリース前ToDoリスト — "Shugo Maeda" <shugo@...> 2008/07/16

前田です。

[#35531] Re: リリース前ToDoリスト — Nobuyoshi Nakada <nobu@...> 2008/07/16

なかだです。

[#35532] Re: リリース前ToDoリスト — "Shugo Maeda" <shugo@...> 2008/07/16

前田です。

[#35534] Re: リリース前ToDoリスト — Nobuyoshi Nakada <nobu@...> 2008/07/16

なかだです。

[#35551] [Ruby 1.8 - Bug #212] Issues with Readline in Mac OS X — Takao Kouji <kouji@...7.net> 2008/07/16

高尾宏治です。

[#35553] Re: [Ruby 1.8 - Bug #212] Issues with Readline in Mac OS X — "Keita Yamaguchi" <keita.yamaguchi@...> 2008/07/16

山口と申します。

[#35556] Re: [Ruby 1.8 - Bug #212] Issues with Readline in Mac OS X — Takao Kouji <kouji@...7.net> 2008/07/17

高尾宏治です。

[#35588] Re: [Ruby 1.8 - Bug #212] Issues with Readline in Mac OS X — Takao Kouji <kouji@...7.net> 2008/07/19

高尾宏治です。

[#35592] Re: [Ruby 1.8 - Bug #212] Issues with Readline in Mac OS X — Takao Kouji <kouji@...7.net> 2008/07/19

高尾宏治です。

[#35629] Re: [Ruby 1.8 - Bug #212] Issues with Readline in Mac OS X — "M.Suzuki" <macobasi@...> 2008/07/22

GyRCJDMkcyRLJEEkTyEjGyhCTS5TdXp1a2kbJEIkRyQ5ISMbKEINCg0KGyRCO24kNyRGJF8kXiQ3

[#35639] Re: [Ruby 1.8 - Bug #212] Issues with Readline in Mac OS X — Takao Kouji <kouji@...7.net> 2008/07/23

高尾宏治です。

[#35372] patch for ruby-core:17472 — wanabe <s.wanabe@...>

ワナベと申します。

16 messages 2008/07/05
[#35378] Re: patch for ruby-core:17472 — Nobuyoshi Nakada <nobu@...> 2008/07/06

なかだです。

[#35404] ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — "Shugo Maeda" <shugo@...>

前田です。

54 messages 2008/07/09
[#35405] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — Urabe Shyouhei <shyouhei@...> 2008/07/09

卜部です。

[#35413] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — "Shugo Maeda" <shugo@...> 2008/07/09

前田です。

[#35415] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — Urabe Shyouhei <shyouhei@...> 2008/07/09

卜部です。

[#35418] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — "Shugo Maeda" <shugo@...> 2008/07/10

前田です。

[#35425] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — Urabe Shyouhei <shyouhei@...> 2008/07/10

Shugo Maeda さんは書きました:

[#35427] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — "GOTO Kentaro" <gotoken@...> 2008/07/10

どこにぶら下げるのがいいのかわからないので、単に意思表明ですが、

[#35429] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — Urabe Shyouhei <shyouhei@...> 2008/07/10

卜部です。

[#35440] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — "Akinori MUSHA" <knu@...> 2008/07/11

At Fri, 11 Jul 2008 01:00:29 +0900,

[#35442] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — "Shugo Maeda" <shugo@...> 2008/07/11

前田です。

[#35451] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — Urabe Shyouhei <shyouhei@...> 2008/07/12

そういえばこの部分に言及するのを忘れていた

[#35454] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — "Shugo Maeda" <shugo@...> 2008/07/12

前田です。

[#35455] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — Urabe Shyouhei <shyouhei@...> 2008/07/12

卜部です。

[#35456] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — "Shugo Maeda" <shugo@...> 2008/07/13

前田です。

[#35462] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — Tanaka Akira <akr@...> 2008/07/13

In article <704d5db90807121803o5ea67361ucbf968f8a18a845d@mail.gmail.com>,

[#35465] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — Urabe Shyouhei <shyouhei@...> 2008/07/13

Tanaka Akira さんは書きました:

[#35474] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — "Shugo Maeda" <shugo@...> 2008/07/14

前田です。

[#35457] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — Urabe Shyouhei <shyouhei@...> 2008/07/13

卜部です。

[#35472] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — "Shugo Maeda" <shugo@...> 2008/07/14

前田です。

[#35473] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — Urabe Shyouhei <shyouhei@...> 2008/07/14

卜部です。

[#35475] Re: ruby_1_8_6/ruby_1_8_7ブランチのメンテナンスポリシーについて — "Shugo Maeda" <shugo@...> 2008/07/14

前田です。

[#35420] Re: [ruby-cvs:25212] Ruby:r17993 (trunk): * test/ruby/envutil.rb (assert_normal_exit): finish writing script — Tanaka Akira <akr@...>

In article <200807100931.m6A9V4vi014459@ci.ruby-lang.org>,

11 messages 2008/07/10
[#35421] Re: [ruby-cvs:25212] Ruby:r17993 (trunk): * test/ruby/envutil.rb (assert_normal_exit): finish writing script — wanabe <s.wanabe@...> 2008/07/10

ワナベです。

[#35422] Re: [ruby-cvs:25212] Ruby:r17993 (trunk): * test/ruby/envutil.rb (assert_normal_exit): finish writing script — "U.Nakamura" <usa@...> 2008/07/10

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

[#35423] Re: [ruby-cvs:25212] Ruby:r17993 (trunk): * test/ruby/envutil.rb (assert_normal_exit): finish writing script — wanabe <s.wanabe@...> 2008/07/10

ワナベです。

[#35458] make profiler for gc — authorNari <authornari@...>

nariです。

21 messages 2008/07/13
[#35461] Re: make profiler for gc — Tanaka Akira <akr@...> 2008/07/13

In article <1153cee60807122239t19f6ae05vc0c1995c77349377@mail.gmail.com>,

[#35468] Re: make profiler for gc — authorNari <authornari@...> 2008/07/13

nariです。

[#35597] [request]C APIの拡張 — "Goro Fuji" <g.psy.va@...>

藤と申します。

15 messages 2008/07/20

[#35620] non-locale filename encoding — Tanaka Akira <akr@...>

Dir の使いかたとして、ファイル名のエンコーディングが locale

18 messages 2008/07/21
[#35634] Re: non-locale filename encoding — "NARUSE, Yui" <naruse@...> 2008/07/22

成瀬です。

[#35635] Re: non-locale filename encoding — Tanaka Akira <akr@...> 2008/07/23

In article <48866F3F.80906@airemix.jp>,

[#35642] Re: non-locale filename encoding — "NARUSE, Yui" <naruse@...> 2008/07/23

成瀬です。

[#35643] Re: non-locale filename encoding — Tanaka Akira <akr@...> 2008/07/23

In article <488771FD.4020800@airemix.jp>,

[#35649] PENDINGS.rb (Was: Re: [Ruby 1.9 - Bug #354] (Assigned) Test failure test/ruby/test_transcode.rb) — "Yusuke ENDOH" <mame@...>

遠藤です。

14 messages 2008/07/24
[#35650] Re: PENDINGS.rb (Was: Re: [Ruby 1.9 - Bug #354] (Assigned) Test failure test/ruby/test_transcode.rb) — Tanaka Akira <akr@...> 2008/07/24

In article <e0b1e5700807240845o4c09cfa5gae142c1dd0c74170@mail.gmail.com>,

[#35651] Re: PENDINGS.rb (Was: Re: [Ruby 1.9 - Bug #354] (Assigned) Test failure test/ruby/test_transcode.rb) — "Yusuke ENDOH" <mame@...> 2008/07/24

2008/07/25 1:02 Tanaka Akira <akr@fsij.org>:

[#35654] Re: PENDINGS.rb (Was: Re: [Ruby 1.9 - Bug #354] (Assigned) Test failure test/ruby/test_transcode.rb) — "NARUSE, Yui" <naruse@...> 2008/07/24

成瀬です。

[#35686] Re: PENDINGS.rb (Was: Re: [Ruby 1.9 - Bug #354] (Assigned) Test failure test/ruby/test_transcode.rb) — "Yusuke ENDOH" <mame@...> 2008/07/29

遠藤です。

[ruby-dev:35551] [Ruby 1.8 - Bug #212] Issues with Readline in Mac OS X

From: Takao Kouji <kouji@...7.net>
Date: 2008-07-16 16:48:38 UTC
List: ruby-dev #35551
高尾宏治です。

# Subjectを変えます。

On 2008/07/16, at 15:33, Nobuyoshi Nakada wrote:
> At Wed, 16 Jul 2008 11:45:06 +0900,
> Shugo Maeda wrote in [ruby-dev:35532]:
>> Ruby側でとりあえず対応するという点については異論はないのですが、
>> バグだとしたらバージョンによって挙動が変わったら嫌だなと思いました。
>
> 初期化のときにチェックするなら、バージョンが変わっても気にしなく
> てすむと思います。

初期化の時にチェックするのも良さそうですね。
ただし、Readlineの拡張ライブラリの初期化時に、
毎回 libedit とリンクしているかどうかを確認するのは、
どうかということがあると思います。
これについては、Init_readline()で以下のような処理をすると思うのですが、
対したコストではないため、気にしなくても良いのかもしれません。

  if (strncmp(rl_library_version, "EditLine wrapper", 
              strlen("EditLine wrapper")) == 0) {
      /* libedit の場合の処理 */
  }
  else {
      /* libedit の場合の処理 */
  }

>>>> 高尾君のパッチと大分趣が異なるような気がするのですが、どういう意図でしょうか。
>>>
>>> history_baseの初期値を保存しておいて、そこからの差分で見るという
>>> ことです。
>>
>> 自分がlibeditの挙動を理解していないだけかもしれないのですが、それで上手く
>> 動くのでしょうか。
>> 高尾君のパッチではたんにhistory_baseをhistory_base - 1にしているだけだった
>> ので、libeditではhistory_baseの値が1ずれているとかそういう話なのかなと思った
>> のですが。
>
> そのズレの値を初期状態でとれないかと思ったのですが、初期値はずれ
> ているわけではないとしたら的外れかもしれません。後は、
> remove_history()があるならですが、[ruby-dev:35519]のテストコード
> を実行してみるとかしかないですね。
>
> ついでにいえば、remove_history()やreplace_history_entry()も同じ
> くindexをとるわけですが、こちらは問題ないんでしょうか。

問題がありました。
どうも、ヒストリのインデックスの開始が、
* GNU Readline は 1。(history_base と同じ)
* libedit は 0。
という違いがあるようです。
このため、remove_historyなども同様に修正する必要がありました。
これは以下のコードで確認しました。
----- ここから -----
#include <stdio.h>

#ifdef HAVE_EDITLINE_READLINE_H
#include <editline/readline.h>
#else
#include <readline/readline.h>
#include <readline/history.h>
#endif /* HAVE_EDITLINE_READLINE_H */

int main(int argc, char **argv)
{
  HIST_ENTRY *entry;
  int i;

  using_history();

  printf("history_base: %d\n", history_base);

  add_history("1");
  add_history("2");
  add_history("3");

  printf("added 1, 2, 3 to history\n");
  printf("history_base: %d\n", history_base);
  printf("history_length: %d\n", history_length);

  entry = history_get(history_base);
  printf("history_get(history_base): %s\n", entry->line);
  
  for (i = 0; i <= history_length; i++) {
    entry = history_get(i);
    printf("history_get(%d): %s\n", i, entry ? entry->line : "NULL");
  }
  
  return 0;
}
----- ここまで -----

以下、GNU Readline、Mac OSX の libedit、
libedit の 20080712-2.11 で実行した結果です。
----- ここから -----
---- no212_on-macosx.gnu_readline ----
history_base: 1
added 1, 2, 3 to history
history_base: 1
history_length: 3
history_get(history_base): 1
history_get(0): NULL
history_get(1): 1
history_get(2): 2
history_get(3): 3
---- no212_on-macosx.editline ----
history_base: 1
added 1, 2, 3 to history
history_base: 1
history_length: 3
history_get(history_base): 2
history_get(0): 1
history_get(1): 2
history_get(2): 3
history_get(3): NULL
---- no212_on-macosx.editline_20080712-2.11 ----
history_base: 1
added 1, 2, 3 to history
history_base: 1
history_length: 3
history_get(history_base): 2
history_get(0): 1
history_get(1): 2
history_get(2): 3
history_get(3): NULL
----- ここまで -----

最後にこれまでの話などを考慮したパッチを作成しました。
実行時に libedit であれば index のオフセットを 0 に、
そうでない(GNU Readline であれば) オフセットを history_base に
設定するようにしています。

Mac OSX 10.5.4(昨日10.5.3からアップデートしました)の環境で、
動作を確認しています。

$ ~/local/bin/ruby19trunk -rreadline -ve 'puts Readline::VERSION; Readline::HISTORY.push("1", "2", "3"); Readline::HISTORY.each { |s| puts s }; p Readline::HISTORY[1]; Readline::HISTORY[1] = "A" ; p Readline::HISTORY[1]; Readline::HISTORY.delete_at(0); p Readline::HISTORY[0]; p Readline::HISTORY.length; p Readline::HISTORY.pop; p Readline::HISTORY.pop; p Readline::HISTORY.pop; '
ruby 1.9.0 (2008-07-16 revision 18071) [i686-darwin9.4.0]
EditLine wrapper
1
2
3
"2"
"A"
"A"
2
"3"
"A"
nil

----- ここから -----
Index: ext/readline/readline.c
===================================================================
--- ext/readline/readline.c	(revision 18084)
+++ ext/readline/readline.c	(working copy)
@@ -43,6 +43,8 @@
 # define rl_completion_matches completion_matches
 #endif
 
+static int history_offset = 0;
+
 static char **readline_attempted_completion_function(const char *text,
                                                      int start, int end);
 
@@ -516,7 +518,7 @@
     if (i < 0) {
         i += history_length;
     }
-    entry = history_get(history_base + i);
+    entry = history_get(i + history_offset);
     if (entry == NULL) {
 	rb_raise(rb_eIndexError, "invalid index");
     }
@@ -536,7 +538,7 @@
     if (i < 0) {
         i += history_length;
     }
-    entry = replace_history_entry(i, RSTRING_PTR(str), NULL);
+    entry = replace_history_entry(i + history_offset, RSTRING_PTR(str), NULL);
     if (entry == NULL) {
 	rb_raise(rb_eIndexError, "invalid index");
     }
@@ -578,7 +580,7 @@
     VALUE val;
 
     rb_secure(4);
-    entry = remove_history(index);
+    entry = remove_history(index + history_offset);
     if (entry) {
         val = rb_tainted_str_new2(entry->line);
         free(entry->line);
@@ -624,7 +626,7 @@
 
     rb_secure(4);
     for (i = 0; i < history_length; i++) {
-        entry = history_get(history_base + i);
+        entry = history_get(i + history_offset);
         if (entry == NULL)
             break;
 	rb_yield(rb_tainted_str_new2(entry->line));
@@ -795,6 +797,10 @@
     rb_define_const(mReadline, "USERNAME_COMPLETION_PROC", ucomp);
 #if defined HAVE_RL_LIBRARY_VERSION
     rb_define_const(mReadline, "VERSION", rb_str_new2(rl_library_version));
+    if (strncmp(rl_library_version, "EditLine wrapper", 
+		strlen("EditLine wrapper")) != 0) {
+	history_offset = history_base;
+    }
 #else
     rb_define_const(mReadline, "VERSION", rb_str_new2("2.0 or prior version"));
 #endif


In This Thread