Bug #10384
closedFiddle::DLError: unknown symbol "Init_objspace" during Fiddle::TestHandle#test_NEXT and Fiddle::TestHandle#test_static_sym on Solaris
Description
Solarisにて、make test-all中に以下のエラーが発生することが多くなっています。
(出ないこともたまにあります。)
2) Error:
DL::TestHandle#test_static_sym:
DL::DLError: unknown symbol "Init_objspace"
/XXXXX/test/dl/test_handle.rb:34:in `sym'
/XXXXX/test/dl/test_handle.rb:34:in `rescue in test_static_sym'
/XXXXX/test/dl/test_handle.rb:27:in `test_static_sym'
4) Error:
Fiddle::TestHandle#test_NEXT:
Fiddle::DLError: unknown symbol "Init_objspace"
/XXXXX/test/fiddle/test_handle.rb:171:in `[]'
/XXXXX/test/fiddle/test_handle.rb:171:in `rescue in test_NEXT'
/XXXXX/test/fiddle/test_handle.rb:144:in `test_NEXT'
5) Error:
Fiddle::TestHandle#test_static_sym:
Fiddle::DLError: unknown symbol "Init_objspace"
/XXXXX/test/fiddle/test_handle.rb:41:in `sym'
/XXXXX/test/fiddle/test_handle.rb:41:in `rescue in test_static_sym'
/XXXXX/test/fiddle/test_handle.rb:34:in `test_static_sym'
Fiddle::Handle.sym および Fiddle::Handle.[] (DL::Handle.sym なども同様)は内部で RTLD_NEXT を使用しています。
Solarisのman dlsym(3C) より引用します。
http://docs.oracle.com/cd/E23823_01/html/816-5168/dlsym-3c.html
RTLD_NEXT Instructs dlsym() to search for the named
symbol in the objects that were loaded fol-
lowing the object from which the dlsym()
call is being made.
Solarisのdlsymでは、handleに RTLD_NEXT を指定した場合は、そのコードが読み込まれた後に読み込んだシンボルしか検索しません。
このため、require "objspace" による objspace.so の読み込みが require "fiddle" より前に発生していた場合はエラーになります。
(requireの順番によりエラーが出る・出ないの再現コード)
% ruby -e 'require "objspace"; require "fiddle"; p Fiddle::Handle.sym("Init_objspace")'
-e:1:in `sym': unknown symbol "Init_objspace" (Fiddle::DLError)
from -e:1:in `<main>'
% ruby -e 'require "fiddle"; require "objspace"; p Fiddle::Handle.sym("Init_objspace")'
9223372034655938496
単純にgrepすると、require "objspace" は以下で行われています。
test/dl/test_handle.rb: require 'objspace'
test/fiddle/test_closure.rb: require 'objspace'
test/fiddle/test_handle.rb: require 'objspace'
test/lib/profile_test_all.rb:require 'objspace'
test/objspace/test_objspace.rb:require "objspace"
test/ruby/test_file_exhaustive.rb: require "objspace"
これらのテストの実行順番に依存して(ファイルシステムのディレクトリエントリの順番の偶然などのタイミングによって?)、エラーが出たり出なかったりするようです。
Updated by hsbt (Hiroshi SHIBATA) almost 10 years ago
- Related to Bug #9928: Fiddle::TestHandle#test_NEXT fails on AIX due to unexported symbols of extension libraries added
Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset r49157.
test_handle.rb: use -test-/dln/empty
- test/fiddle/test_handle.rb (test_NEXT): use -test-/dln/empty
which is always a shared object and is not used by others.
[ruby-dev:48629] [Bug #10384]
Updated by usa (Usaku NAKAMURA) almost 10 years ago
- Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED
Updated by nagachika (Tomoyuki Chikanaga) over 9 years ago
- Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE
Backported into ruby_2_1
at r50129.
Updated by ngoto (Naohisa Goto) over 9 years ago
- Related to Backport #11085: Fiddle::TestHandle#test_static_sym and Fiddle::TestHandle#test_NEXT: LoadError: cannot load such file -- -test-/dln/empty added
Updated by ngoto (Naohisa Goto) over 9 years ago
- Backport changed from 2.0.0: REQUIRED, 2.1: DONE to 2.0.0: REQUIRED, 2.1: REQUIRED
Updated by usa (Usaku NAKAMURA) over 9 years ago
- Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE
ruby_2_1 r50383 merged revision(s) 49154,49155,49156,49159.
Updated by nagachika (Tomoyuki Chikanaga) over 8 years ago
- Backport changed from 2.0.0: REQUIRED, 2.1: DONE to 2.0.0: REQUIRED, 2.1: DONE, 2.2: DONE
Backported into ruby_2_2
branch at r54316.
Updated by nagachika (Tomoyuki Chikanaga) over 8 years ago
r49154 should be backported too. Backported into ruby_2_2
branch at r54342.