Repeat recovers on databases

Bron Gondwana brong at fastmail.fm
Thu Jun 18 19:57:03 EDT 2009


On Thu, Jun 18, 2009 at 05:44:19PM -0400, Michael Bacon wrote:
> Another one stomped here.  This time, it's a 32/64 bit issue.  myinit in  
> cyrusdb_skiplist.c assumes that type_t is 4 bytes long, and writes out 
> that many from the current timestamp when creating $confdir/db/skipstamp. 

Actually, reading the code, that's not strictly true:

>        a = htonl(global_recovery);
> -       if (r != -1) r = write(fd, &a, 4);
> +       if (r != -1) r = write(fd, &a, sizeof(time_t));

It writes "a", which is the result of calling htonl on global_recovery.

If htonl isn't returning a 32 bit value of the lower order bytes of the
value that it's given, then this bug is going to be causing a LOT more
problems than just this.  We assume this works in quite a few other
places in the code, including the timestamp value in the skiplist header
itself, and in places throughout the mailbox code too.

"htonl" => "host to net long" by my reading.  There's also htonll for 64
bit values.  Is your platform creating net longlongs?

time_t a;

There's the actual bug.  That should be bit32 a;

Bron.


More information about the Cyrus-devel mailing list