[#30408] Ruby 1.8.6 preview2 has been released — "Akinori MUSHA" <knu@...>

 Ruby 1.8.6 preview2 をリリースしました。

20 messages 2007/02/24
[#30414] fail to autoload at $SAFE==4 (Re: Ruby 1.8.6 preview2 has been released) — Hidetoshi NAGAI <nagai@...> 2007/02/25

永井@知能.九工大です.

[#30418] Re: fail to autoload at $SAFE==4 (Re: Ruby 1.8.6 preview2 has been released) — Nobuyoshi Nakada <nobu@...> 2007/02/25

なかだです。

[ruby-dev:30340] Re: [ruby_1_8] can't grub Digest::SHAxxx on powerpc-darwin

From: "Akinori MUSHA" <knu@...>
Date: 2007-02-14 13:24:04 UTC
List: ruby-dev #30340
 報告ありがとうございます。

At Mon, 12 Feb 2007 02:20:49 +0900,
Tadashi Saito wrote:
> $ make test-all
> ./miniruby  ../../ruby_1_8/runruby.rb --extout=.ext --
> "../../ruby_1_8/test/runner.rb" --basedir="../../ruby_1_8/test"
> --runner=console
> <HOME>/svn/ruby/o/ruby_1_8/.ext/common/digest.rb:16:in
> `const_missing': Digest class not found: Digest::SHA384 (NameError) 
> make: *** [test-all] Error 1

 デバッグしてみたんですが、 const_missing に行く前に
rb_const_get_0 -> rb_autoload_load -> Init_sha2 ->
rb_define_class_under -> rb_const_get_0 と再入しているところで
method_missing に入って行ってエラーとってしまうようです。
(Pure Ruby のコードでは再現しない模様)

> ただなぜか、定数として存在しているようには見えます。
> 
> $ ruby_1_8 -rdigest -e 'p Digest.constants'
> ["SHA256", "Base", "SHA512", "SHA384", "Instance", "Class"]

 autoload なので、定数として定義されます。内部的には中身は
Qundef で、参照されると見えないインスタンス変数 __autoload__ を
引いて autoload 処理を行い、定義された値を返します。

> なお下の環境では、Digest::SHA384の評価に問題は出ませんでした。
> 
> ruby 1.9.0 (2007-02-10 patchlevel 0) [powerpc-darwin8.8.0]
> ruby 1.8.5 (2007-02-11 patchlevel 5000) [i686-linux]
> ruby 1.9.0 (2007-02-10 patchlevel 0) [i686-linux]

 たまたま 1.8.5 on OS X で起きているのか、あるいはたまたま他の
環境で起きていないだけなのかはまだ突き止められていません。

 とりあえず autoload を外す回避策を trunk および ruby_1_8 に
入れました。

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Different eyes see different things,
    Different hearts beat on different strings --
       But there are times for you and me when all such things agree"

In This Thread