[Python-bugs-list] [ python-Bugs-491888 ] whichdb lies about db type

noreply@sourceforge.net noreply@sourceforge.net
Wed, 12 Dec 2001 15:28:48 -0800


Bugs item #491888, was opened at 2001-12-11 19:22
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=491888&group_id=5470

Category: Python Library
Group: Python 2.1.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Richard Jones (richard)
Assigned to: Nobody/Anonymous (nobody)
Summary: whichdb lies about db type

Initial Comment:
>>> import dbm
>>> d = dbm.open('foo', 'n')
>>> d['a'] = 'b'
>>> d.close()
>>> import whichdb
>>> whichdb.whichdb('foo.db')
'dbhash'

I'm currently testing for the existence of "foo.db" 
instead of "foo" and hard-code my routines to use dbm 
if there is a "foo.db" file (since all other db 
modules that I've tested do no append ".db")

Might it also be possible to have anydbm perform a 
whichdb check in its open function, so that older 
databases are usable with newer, more feature-full 
installations that might include "better" dbm 
backends?



----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2001-12-12 15:28

Message:
Logged In: YES 
user_id=21627

I fail to see the problem altogether. What system are you
on? Why do you think dbm does not create dbhash files? It is
not just that the magic says they are BSDDB DB_HASH files,
they really are of that kind?

Also, which of the APIs (dbm, dbhash) do you consider
"better"? I'd say that dbhash is better, since it builds
upon bsddb. So whichdbm, and anydbm, do use the "better" dbm
backend already?

Where is the bug?

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-11 20:28

Message:
Logged In: YES 
user_id=6380

Hm. anydmb *does* use whichdb. The problem seems to be that
the dbm file really *does* look like a BSD hash -- the Unix
file(1) command has the same problem.

But I'm not sure I understand your question. Do you have a
particular patch in mind?

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=491888&group_id=5470