[Box Backup] problems with large files?

Chris Wilson boxbackup@fluffy.co.uk
Tue, 25 Apr 2006 19:32:47 +0000 (GMT)


Hi Paul,

> 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.

Well, according to the headers that I can find, it's never defined as 
being anything else. Windows' POSIX support does not appear to cater for 
large files at all, which means that we need to replace all POSIX calls 
with native ones.

> 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.

I would not recommend that we commit anything like this. All files over 2 
GB in size on every platform will silently wrap back to zero.

> Files bigger than that will be truncated, which is better than barfing.

I'm not sure that it is. We should definitely check for files that are too 
big to be backed up correctly on the current platform, and refuse to try. 
But we should not crash or report negative file sizes either. Thanks for 
reporting this.

Cheers, Chris.
-- 
_ ___ __     _
  / __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |