Negative file sizes in cached files when file >2GB
As reported in the forum ( http://forum.owncloud.org/viewtopic.php?f=4&t=5053 ):
A bug in the cached files in the mysql. A File with more than 2 GB on a 32bit System will have a negative size. The MySQL table is set to bigint which is correct. I took a look at the source there you are working with int vars which is not recommended on 32bit Systems for big numbers!!! Please use float here. This breaks the folder size, file size and the quota.
If possible, questions should be asked in the forum.
@icewind1991 Can you please have a look? THX
I've managed to reproduce on a 32 bit test system but I can't figure out the cause
Run a filesystem scan over a folder with more then 2 GB of data, by emptying the fscache table and running scanfiles(true) in the JavaScript console
The original report is right on his statement about the signed 32-bit integer: http://php.net/manual/en/function.stat.php - see the note in there.
this signed 32-bit integer is used as type for the calculated result - this should be easy to change
In addition we need to find a solution to get the size of files bigger than 2GB - @icewind1991 any solution on your mind?
I cannot reproduce this on my 32-bit system. I'd try the following: 1.) cast the return to float in https://github.com/owncloud/core/blob/master/lib/filecache.php#L440 2.) (really needed?) initialize $totalSize with a float zero in https://github.com/owncloud/core/blob/master/lib/filecache.php#L385
@icewind1991 What do you think?
ping
A PHP int should automatically be converted to a float on overflow. Maybe this is DB related? @RandolfCarter @icewind1991 @DeepDiver1975 Which exact DB types and versions do you use?
It was not me who had that problem, it came up in the forum, I'll try to relay the question.
$ mysql --version mysql Ver 14.14 Distrib 5.5.28, for debian-linux-gnu (i686) using readline 6.2
I too am seeing this problem on a 32 bit system. CentOS DVD was uploaded as a test (4.0gb) and reports -5580800 B in owncloud. Obviously I had to use the sync application to get this one uploaded. It was done using the xubuntu linux client.
debian 6.0.4
Linux boxname 2.6.32-5-686 #1 SMP Mon Mar 26 05:20:33 UTC 2012 i686 GNU/Linux
mysql Ver 14.14 Distrib 5.1.61, for debian-linux-gnu (i486) using readline 6.1
Server version: Apache/2.2.16 (Debian)
PHP 5.3.3-7+squeeze14 with Suhosin-Patch (cli) (built: Aug 6 2012 20:08:59) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
I could reproduce this one - finally. On a 32bit system stat cannot handle files bigger than 2GB - see my comment above https://github.com/owncloud/core/issues/388#issuecomment-10532647
Possible solution: http://www.phpclasses.org/browse/file/32900.html http://stackoverflow.com/questions/6482211/php-filesize-over-4gb
I'll go for that: http://php.net/manual/de/function.filesize.php#80959
this is fixed for OC5 @karlitschek shall we backport this? 'Only' 32bit systems are affected
@DeepDiver1975 Yes. Would be great
will be shipped with 4.5.7