ruby-changes:20576
From: naruse <ko1@a...>
Date: Fri, 22 Jul 2011 21:49:21 +0900 (JST)
Subject: [ruby-changes:20576] naruse:r32624 (ruby_1_9_3): merge revision(s) 32590:
naruse 2011-07-22 21:49:11 +0900 (Fri, 22 Jul 2011) New Revision: 32624 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32624 Log: merge revision(s) 32590: ------------------------------------------------------------------------ r32590 | naruse | 2011-07-21 00:20:14 +0900 (Thu, 21 Jul 2011) | 7 lines Add test for r32586. FreeBSD (at least 7.2 to 7.2) calls nsdispatch(3) when it calls getaddrinfo(3). And nsdispatch(3) doesn't call dlerror(3) even if it calls _nss_cache_cycle_prevention_function with dlsym(3). So our DL::Handle#sym must call dlerror(3) before call dlsym. In general uses of dlerror(3) should call it before use it. ------------------------------------------------------------------------ Modified files: branches/ruby_1_9_3/test/dl/test_handle.rb Index: ruby_1_9_3/test/dl/test_handle.rb =================================================================== --- ruby_1_9_3/test/dl/test_handle.rb (revision 32623) +++ ruby_1_9_3/test/dl/test_handle.rb (revision 32624) @@ -169,5 +169,16 @@ handle = DL::Handle::DEFAULT assert_not_nil handle['malloc'] end unless /mswin|mingw/ =~ RUBY_PLATFORM + + def test_dlerror + # FreeBSD (at least 7.2 to 7.2) calls nsdispatch(3) when it calls + # getaddrinfo(3). And nsdispatch(3) doesn't call dlerror(3) even if + # it calls _nss_cache_cycle_prevention_function with dlsym(3). + # So our DL::Handle#sym must call dlerror(3) before call dlsym. + # In general uses of dlerror(3) should call it before use it. + require 'socket' + Socket.gethostbyname("localhost") + DL.dlopen("/usr/lib/libc.so").sym('strcpy') + end if /freebsd/=~ RUBY_PLATFORM end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/