[Box Backup] problems with large files?

Paul Nash boxbackup@fluffy.co.uk
Tue, 25 Apr 2006 15:07:45 -0400


I *think* that I have a short-term fix for the Windows problem.

It looks like gcc-mingw gets confused by the multiple variations on "struct
stat" and its members, and somehow decided that st_size is an int32.  When
a file is bigger than 2**31, it sign-extended when it is assigned to an
int64 (or even a uint64; maybe need to typecase to uint32 first?).

Anyway, if I hit "BackupClientFileAttributes::ReadAttributes" and modify

	if (pFileSize) { *pFileSize = st.st_size;}

to

	if (pFileSize) {
	   *pFileSize = st.st_size;
	   *pFileSize &= 0x00000000FFFFFFFF;
	}

suddenly, it works (or seems to).  Of course, that only fixes the problem
up to 2**32 bytes.  Files bigger than that will be truncated, which is
better than barfing.

Of course, what I *really* need to do is take a look at the preprocessor
output and find out what's going on and why.  I'l leave that for a rainy
weekend when I'm all alone and bored :-).

Well ...

I took a quick peek and found that the includes come from a place that I
didn't look, and surprise!   "struct stat" has a 32-bit signed "st_size".
I should probably hack the source and configure to check and do something,
but for now I've just hacked at the system include file (yes, I know it'll
come back to bite me, but right now I don't really care and I hate Windows
anyway).

Hold yer breaths ...

<drum roll> and it looks like it works.  Uploading a whole raft of big
files to the server, to check.

	paul