Re: dbm.open Blind?

Michael McLay (mclay@eeel.nist.gov)
Wed, 30 Mar 94 16:43:05 EST

> From jack@cwi.nl Wed Mar 30 03:42:55 1994
> To: friedric@rsoc.rockwell.com (Robin Friedrich)
>
I did rebuild python recently to add the SUIT module from UVA and I threw
in Mike McLay's dbhash module at the same time as well. But I didn't have
any build warnings with the dbm stuff. I hadn't used it before so I don't
know if it used to work or not. If there was a build problem why did the import
work?
I tried to open a new database file and got the following:

>>> import dbm
>>> x = dbm.open('XXX','rw',0644)
>>> len(x)
0
>>>
darwin 5 % ll
total 44
drwxr-xr-x 2 friedric 512 Mar 30 07:15 ./
drwxr-xr-x 7 friedric 1024 Mar 29 17:14 ../
-rw-r--r-- 1 friedric 4096 Mar 29 17:14 Notebase.dir
-rw-r--r-- 1 friedric 16384 Mar 29 17:14 Notebase.pag
-rw-r--r-- 1 friedric 16384 Mar 30 07:15 XXX.db
...

The BSD ndbm implementation is not backwards compatible with the
file format of the original ndbm implemetations. Breaking
compatiblity was necessary in order to fix the string length
limitations of ndbm. I haven't tested build the original dbm
module with the dbhash module. I think it should be possible, but you
may have to delete the ndbm function calls from the libdb.a archive so
they aren't found in the standard library and the new BSD library at
link time.

Michael