Re: Repeat recovers on databases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux