#40633 [Opn->Fbk]: disk_free_space returns a bad result on filesystems with negative free space

From: Date: Mon, 26 Feb 2007 15:44:08 +0000
Subject: #40633 [Opn->Fbk]: disk_free_space returns a bad result on filesystems with negative free space
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-109565@lists.php.net to get a copy of this message
ID: 40633 Updated by: tony2001@php.net Reported By: adam-phpbugs at adam dot gs -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: FreeBSD PHP Version: 5.2.1 New Comment: Please provide an SSH account on a machine where I can reproduce it. Previous Comments: ------------------------------------------------------------------------ [2007-02-26 13:33:03] adam-phpbugs at adam dot gs changing OS to FreeBSD ------------------------------------------------------------------------ [2007-02-26 13:32:36] adam-phpbugs at adam dot gs This was FreeBSD if you look at the FreeBSD manpage for tunefs(8), this is the intended behaviour. http://www.freebsd.org/cgi/man.cgi? query=tunefs&apropos=0&sektion=0&manpath=FreeBSD+6.2- RELEASE&format=html Basically, in FreeBSD (under UFS2 at least) avaliable space is calculated as total minus used minus reserved. A small % (8 by default) is reserved. So, this is not really a bug, but actually an intended feature. ------------------------------------------------------------------------ [2007-02-26 09:33:41] tony2001@php.net What kind of BSD is that and don't you think that negative free space is a BSD bug? ------------------------------------------------------------------------ [2007-02-26 00:55:02] adam-phpbugs at adam dot gs Description: ------------ on a filesystem with a negative amount of free space (this can happen on at least FreeBSD) disk_free_space returns unreasonable results. -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:55]=- [root@cube]# php -r 'print disk_free_space(".")."\n";' 3.77789318629E+22 -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:57]=- [root@cube]# df -h . Filesystem Size Used Avail Capacity Mounted on /dev/ad7 289G 289G -23G 109% /some/path -=[/some/path]=- -=[Sun Feb 25]=- -=[19:51:58]=- [root@cube]# df . Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/ad7 302732078 302699550 -24186038 109% /some/ path Reproduce code: --------------- php -r 'print disk_free_space(".")."\n";' Expected result: ---------------- -24186038 Actual result: -------------- 3.77789318629E+22 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40633&edit=1

« previous php.bugs (#109565) next »