Bug 141994 - problem with bsddb module and db4-4.3.21
problem with bsddb module and db4-4.3.21
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: python (Show other bugs)
rawhide
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-12-06 11:49 EST by Todd Mokros
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-12-07 18:52:38 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
db-4.3.21 distinguishes DB_BUFFER_SMALL from ENOMEM (3.59 KB, text/plain)
2004-12-07 00:56 EST, Jeff Johnson
no flags Details

  None (edit)
Description Todd Mokros 2004-12-06 11:49:21 EST
Description of problem:
the has_key method always returns False on hash db's opened with
bsddb.  This first occured with python-2.4-1, which appears to be the
first version compiled against db4-4.3 instead of db4-4.2.  

Version-Release number of selected component (if applicable):
db4-4.3.21-1

How reproducible:
everytime

Steps to Reproduce:
1.  open hash db in python, (I used dbhash.open)
2.  for known key in the db, call db.has_key(), which returns 0
3.  for the same key, retrieve using db[], returns existing value.
  
Actual results:
has_key returns 0 for a valid, existing key in the database

Expected results:
has_key should return 1 for an existing key.

Additional info:

$ python
Python 2.4 (#1, Dec  3 2004, 09:58:29) 
[GCC 3.4.3 20041125 (Red Hat 3.4.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbhash
>>> db = dbhash.open('testdb', 'c')
>>> db['testkey'] = 'testval'   
>>> db.has_key('testkey')
0
>>> db['testkey']
'testval'
>>> db.__class__
<class bsddb._DBWithCursor at 0xf6f7274c>
>>> 


I first noticed the problem in spambayes, which wraps a dbhash with
Shelf and uses the get() method which always returns None, since it
checks for key existance with has_key().
Comment 1 Mihai Ibanescu 2004-12-06 14:19:26 EST
Reassigning to jbj, maybe a bsddb issue?
Comment 2 Jeff Johnson 2004-12-07 00:15:28 EST
Ah yes, there is change to return DB_BUFFER_SMALL
rather than ENOMEM in db-4.3.21, I missed this in
subversion as well.

Patch in a few minutes.
Comment 3 Jeff Johnson 2004-12-07 00:56:58 EST
Created attachment 108020 [details]
db-4.3.21 distinguishes DB_BUFFER_SMALL from ENOMEM

This looks much better (previous had errors and segfault):

python test_basics.py
...............................................................................................................................................................

----------------------------------------------------------------------
Ran 159 tests in 47.536s
 
OK

Packages at ftp://jbj.org/pub/fc4 built with the patch, FC4 tomorrow.
Comment 4 Todd Mokros 2004-12-07 15:22:54 EST
The python-2.4-2 packages at jbj.org resolve the issue on my end.

Thanks!

Comment 6 Jeff Johnson 2004-12-07 18:52:38 EST
python-2.4-2 should be in fc4 soon. thanks for verifying the fix.

Note You need to log in before you can comment on or make changes to this bug.