#39520 [Bgs->Opn]: disk_free_space assumes a blocksize of 4096

From: Date: Thu, 16 Nov 2006 03:41:30 +0000
Subject: #39520 [Bgs->Opn]: disk_free_space assumes a blocksize of 4096
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-105046@lists.php.net to get a copy of this message
ID: 39520 User updated by: david at triax dot jp Reported By: david at triax dot jp -Status: Bogus +Status: Open Bug Type: Filesystem function related Operating System: RedHat Enterprise ES 4 PHP Version: 5.2.0 New Comment: This is not a bogus bug. Please reread. Previous Comments: ------------------------------------------------------------------------ [2006-11-15 11:35:32] david at triax dot jp As I wrote initially, it is either using f_frsize or just using a fixed blocksize and as you point out it's using f_frsize, and that is wrong. It should use f_bsize when calculating free space. ------------------------------------------------------------------------ [2006-11-15 09:53:40] tony2001@php.net No, you are wrong. See lines 365-369 here: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/filestat.c?view=annotate ------------------------------------------------------------------------ [2006-11-15 05:26:09] david at triax dot jp Description: ------------ Using disk_free_space() on an NFS mount produced incorrect results so checking with strace, it seems PHP is ignoring the value of f_bsize and either using f_frsize or just using a fixed blocksize of 4096. I haven't checked the source code yet. Calling stat() on the same path shows the correct blocksize for the filesystem, in my case 32768, and so dividing the output of disk_free_space() by 4096 and multiplying by the result of stat()'s blksize element. Expected result: ---------------- I expected the value of disk_free_space() to use the same block size as reproted by stat() on the same path. Actual result: -------------- disk_free_space() seems to use a fixed 4096 byte block size. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39520&edit=1

« previous php.bugs (#105046) next »