NDBM inconsistency

NDBM inconsistency

Post by Victo » Wed, 18 Nov 1998 04:00:00



Hello,

When I do a dbmopen() in a perl program on my FreeBSD machines,
the file that it expects to open or the file that it will create
has a .db extension.  On my Solaris 2.6 machines, the same program
tries to open or create two files with .pag and .dir extensions.
My Linux machines mimic Solaris.  This seems to be a SysV versus
BSD issue but I'm not sure.  The big problem is that I have all
of these operating systems trying to access these NDBM files on
an NFS server.  The files were originally created by the Solaris
machines, therefore my FreeBSD boxes cannot access these files.
Has anyone else run into this problem?  Any solutions?

Thank you,

Victor

p.s. Please reply via email too.

 
 
 

NDBM inconsistency

Post by Bill Pa » Wed, 18 Nov 1998 04:00:00


Daring to challenge the will of the almighty Leviam00se, Victor

: Hello,

: When I do a dbmopen() in a perl program on my FreeBSD machines,
: the file that it expects to open or the file that it will create
: has a .db extension.  On my Solaris 2.6 machines, the same program
: tries to open or create two files with .pag and .dir extensions.
: My Linux machines mimic Solaris.  This seems to be a SysV versus
: BSD issue but I'm not sure.  The big problem is that I have all
: of these operating systems trying to access these NDBM files on
: an NFS server.  The files were originally created by the Solaris
: machines, therefore my FreeBSD boxes cannot access these files.
: Has anyone else run into this problem?  Any solutions?

This is not a problem. It's a lack of understanding on your part.

There is a difference between 'a DB library that provides the same
programming interface as NDBM' and 'a DB library that works like NDBM.'
FreeBSD uses Berkeley DB, which contains an NBDM compatibility interface
for older programs, but which does _NOT_ use the same file format.
Berkeley DB in NDBM compat mode actually just uses the normal
Berkeley DB hash method behind the scenes.

What you should do is use Berkeley DB on both platforms. NDBM has
a byte-order limitation: NDBM files created on big-endian hosts
can't be read on little-endian hosts, and vice-versa. NDBM also has
several limitations in the number of records that will fit in a
database and the length of a single record. Berkeley DB doesn't have
the same limitations.

As for Linux, I doubt it's really using NDBM. More likely it's
using gdbm which is making pretend it's NDBM. I don't think the
file formats are compatible.

-Bill

--
=============================================================================
-Bill Paul            (212) 854-6020 | System Manager, Master of Unix-Fu


=============================================================================
"Mulder, toads just fell from the sky!" "I guess their parachutes didn't open."
=============================================================================