新井です。

In message "[ruby-dev:19374] Re: dbm.so + Berkeley DB[234]"
  on 17 Jan 2003 17:17:43 +0900,
  matz / ruby-lang.org (Yukihiro Matsumoto) wrote:
> まつもと ゆきひろです
> 
> In message "[ruby-dev:19371] dbm.so + Berkeley DB[234]"
>     on 03/01/17, akira yamada / やまだあきら <akira / ruby-lang.org> writes:
> 
> |1.8のdbm.soをBerkeley DB[234]を使って構築した場合、
> |testdbm.rbでエラーが出るようです。
> 
> BDBではDBM.open(path, 0400)はEACCESになるということのようで
> すね。dbm.soでは手当てできないように思います(dbファイルのパ
> スは分からないし)。これは新井さんにテスト内容を見直してもら
> うしかないかなあ。

こんなとこですかねえ? db3 で試しました。test_s_open_error 
が失敗するのは、Berkeley DB では同時オープンが許可されると言
う事なんでしょうね。これも書き換えた方がいいんでしょうね。

このテストで気がついたのですが(最後に添付した結果を見てもら
うとわかりますが)、最近の ruby では、Errno::EWOULDBLOCK がな
くなってます。(EWOULDBLOCK == EAGAIN の場合)

ruby -ve 'p Errno::EWOULDBLOCK'
-e:1: uninitialized constant EWOULDBLOCK at Errno (NameError)
ruby 1.8.0 (2003-01-18) [i586-linux]

ruby-1.6 -ve 'p Errno::EWOULDBLOCK'
-e:1: uninitialized constant EWOULDBLOCK at Errno (NameError)
ruby 1.6.8 (2003-01-17) [i586-linux]

Index: testdbm.rb
===================================================================
RCS file: /usr/local/cvsup/ruby/ruby/ext/dbm/testdbm.rb,v
retrieving revision 1.2
diff -u -u -r1.2 testdbm.rb
--- testdbm.rb	27 Feb 2002 04:52:17 -0000	1.2
+++ testdbm.rb	19 Jan 2003 21:01:10 -0000
@@ -32,9 +32,12 @@
     assert_instance_of(DBM, @dbm = DBM.new(@path))
 
     # prepare to make readonly DBM file
-    DBM.open("tmptest_dbm_rdonly", 0400) {|dbm|
+    DBM.open("tmptest_dbm_rdonly") {|dbm|
       dbm['foo'] = 'FOO'
     }
+    
+    File.chmod(0400, *Dir.glob("tmptest_dbm_rdonly.*"))
+
     assert_instance_of(DBM, @dbm_rdonly = DBM.new("tmptest_dbm_rdonly", nil))
   end
   def teardown

TestDBM#test_aref . TestDBM#test_aset . TestDBM#test_clear . TestDBM#test_close . TestDBM#test_delete . TestDBM#test_delete_if . TestDBM#test_delete_with_block . TestDBM#test_each_key . TestDBM#test_each_pair . TestDBM#test_each_value . TestDBM#test_empty? . TestDBM#test_fetch . TestDBM#test_has_value? . TestDBM#test_haskey? . TestDBM#test_index . TestDBM#test_indexes . TestDBM#test_invert . TestDBM#test_keys . TestDBM#test_length . TestDBM#test_reject . TestDBM#test_replace . TestDBM#test_s_new_has_no_block . TestDBM#test_s_open_error F. TestDBM#test_s_open_lock E. TestDBM#test_s_open_no_create . TestDBM#test_s_open_nolock . TestDBM#test_s_open_with_block . TestDBM#test_select . TestDBM#test_select_with_block . TestDBM#test_shift . TestDBM#test_to_a . TestDBM#test_to_hash . TestDBM#test_update . TestDBM#test_values . TestDBM#test_version 1.8.0. Time: 10.289987 FAILURES!!! Test Results: Run: 35/35(908 asserts) Failures: 1 Errors: 1 Failures: 1 ../../../ruby-rough/lib/rubyunit/runit/cui/testrunner.rb:81: warning: Object#type is deprecated; use Object#class ../../../ruby-rough/lib/rubyunit/runit/assert.rb:69:in `raise_assertion_error'(TestDBM): expected:<Errno::EACCES> but was:<NO EXCEPTION RAISED> (RUNIT::AssertionFailedError) from ../../../ruby-rough/lib/rubyunit/runit/assert.rb:241:in `assert_exception' from testdbm.rb:160:in `test_s_open_error' from ../../../ruby-rough/lib/rubyunit/runit/testcase.rb:64:in `send' from ../../../ruby-rough/lib/rubyunit/runit/testcase.rb:64:in `run_bare' from ../../../ruby-rough/lib/rubyunit/runit/testcase.rb:51:in `run' from ../../../ruby-rough/lib/rubyunit/runit/testsuite.rb:16:in `run' from ../../../ruby-rough/lib/rubyunit/runit/testsuite.rb:15:in `each' from ../../../ruby-rough/lib/rubyunit/runit/testsuite.rb:17:in `run' from ../../../ruby-rough/lib/rubyunit/runit/cui/testrunner.rb:26:in `run' from ../../../ruby-rough/lib/rubyunit/runit/cui/testrunner.rb:20:in `run' from testdbm.rb:592 Errors: 1 testdbm.rb:89:in `test_s_open_lock'(TestDBM): uninitialized constant EWOULDBLOCK at Errno (NameError) from ../../../ruby-rough/lib/rubyunit/runit/testcase.rb:64:in `send' from ../../../ruby-rough/lib/rubyunit/runit/testcase.rb:64:in `run_bare' from ../../../ruby-rough/lib/rubyunit/runit/testcase.rb:51:in `run' from ../../../ruby-rough/lib/rubyunit/runit/testsuite.rb:16:in `run' from ../../../ruby-rough/lib/rubyunit/runit/testsuite.rb:15:in `each' from ../../../ruby-rough/lib/rubyunit/runit/testsuite.rb:17:in `run' from ../../../ruby-rough/lib/rubyunit/runit/cui/testrunner.rb:26:in `run' from ../../../ruby-rough/lib/rubyunit/runit/cui/testrunner.rb:20:in `run' from testdbm.rb:592