Fri 02 Nov 2007 04:38:31 PM UTC, original submission:
(assigning to Pat just so he's copied in on the bug :)
At the moment, the off_t type is used in a couple of places in Bongo, e.g. the queue. The data is sometimes printed out in client/server conversations, viz.:
ConnWriteF(client->conn, "6020 %03d-%s %ld %ld %ld\r\n", queue, entry, (unsigned long)sb.st_size, dSize, lines);
ConnWriteFile(client->conn, fh);
(queue.c:1631 as of svn r525). Sometimes we do it %ld with a cast, other times %lu. Both are wrong.
The sb.st_size is part of 'struct stat', and is of type off_t. This type is different on different systems: 32 or 64 bits.
Probably what we need to do is say that the protocol outputs a value which is an unsigned integer to be contained in 64bits. On 32-bit platforms, we have a slight issue when we have to consume that value, though - we probably have 64-bit types, but we might have issues with files who are so big you need the 64-bits to measure their size :)
There is a general issue here about arch-neutrality of the protocol: that really means we need to define the types needed to hold different types of data. This is probably a post-Bongo 1.0 job, though.
The easy solution for now is probably to downgrade the sb.st_size value to a 32-bit one, and refuse to deal with situations where that causes a problem (e.g., QRETR). The number of files greater than 2Gb etc. should be relatively small in the field.
|