How to determine format of .db files

Simon Matter simon.matter at ch.sauter-bc.com
Tue Sep 17 02:34:40 EDT 2002


On Tuesday 17 September 2002 00:42, Simon Loader wrote:
> > > Sorry, I didn't express myself well. I mean what is the best way to
> > > determine the format of existing db files. When converting db file with
> > > cvt_cyrusdb, one has to know the format of the source files and I want
> > > to determine this file format automagically.

Rob, you were right, I also have to determine how the current cyrus was 
compiled. Is there another way to get this info than using cyradm. The 
problem is that cyradm needs authentication and that's something I can't do 
here.

> >
> > Well, if it only has to work with the current databases...
> >
> > Flat file should be fairly easy to recognize ('file' should be able to
> > do this for you), since it is just plain text.
> >
> > skiplist should start with the following magic string:
> > "\241\002\213\015skiplist file\0\0\0"

That's what I needed.

> >
> > Berkeley DB should be anything else.
>
> wont the file command produce different answers ? Well tell you one
> is data and the other is a database.

At least on RedHat Linux, the file command knows Berkely too:

[root at client134 db]# file mailboxes.db
mailboxes.db: Berkeley DB (Btree, version 8, native byte-order)

But I don't consider this safe because Berkeley DB files could change, don't 
they?

>
> (and just for a laugh )
> add to magic file.
> #Cyrus skiplist file
> 4       string  skiplist\ file  Cyrus skip list





More information about the Info-cyrus mailing list