ID: 40893
User updated by: andrew at digicol dot de
Reported By: andrew at digicol dot de
-Status: Feedback
+Status: Open
Bug Type: Filesystem function related
Operating System: Redhat EL4
PHP Version: 4.4.5
New Comment:
We get the correct sizes with df (I would not have considered posting
the bug report otherwise). We are using df (coreutils) 5.2.1 on RedHat.
The RedHat version is RHEL 4 btw, not 3.
Maybe it is an NFS-related bug that is handled gracefully in df.
Previous Comments:
------------------------------------------------------------------------
[2007-03-22 17:19:58] tony2001@php.net
From what I can see in df sources, it uses exactly the same logics as
PHP, so I don't really see how it's possible that you get correct values
with df, especially taking into account that the f_frsize is broken in
the same way there.
You might want to look at this RH bug:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=146427
It says that RHEL3 U4 fixes it.
------------------------------------------------------------------------
[2007-03-22 15:38:21] andrew at digicol dot de
RedHat Linux:
strace /dot/dc/bin/php/bin/php -r 'echo
number_format(disk_total_space("/mnt")) . "\n";'
...
statfs("/mnt", {f_type="NFS_SUPER_MAGIC", f_bsize=32768,
f_blocks=9158253, f_bfree=5093458, f_bavail=5093458, f_files=0,
f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
...
SuSE Linux:
strace php -r 'echo number_format(disk_total_space("/mnt")) . "\n";'
...
statfs("/mnt", {f_type="NFS_SUPER_MAGIC", f_bsize=32768,
f_blocks=9158253, f_bfree=5093458, f_bavail=5093458, f_files=0,
f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=32768}) = 0
...
Just in case this helps, "df -h" seems to invoke the a different system
call (statfs64, both systems are 32-bit, I am not an expert regarding
system calls). They result in the same f_bsize and fr_size values.
Unlike php, df draws the correct conclusions regarding total / free
space on both systems:
RedHat Linux:
strace df -h
...
statfs64("/mnt", 84, {f_type="NFS_SUPER_MAGIC", f_bsize=32768,
f_blocks=9158253, f_bfree=5093460, f_bavail=5093460, f_files=0,
f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
...
SuSE Linux:
strace df -h
...
statfs64("/mnt", 84, {f_type="NFS_SUPER_MAGIC", f_bsize=32768,
f_blocks=9158253, f_bfree=5093460, f_bavail=5093460, f_files=0,
f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=32768}) = 0
...
------------------------------------------------------------------------
[2007-03-22 15:21:36] tony2001@php.net
If you're still able to reproduce it - try to trace it and figure out
which blocksize is reported by the system and which function is used -
statvfs() or statfs().
------------------------------------------------------------------------
[2007-03-22 15:17:43] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[2007-03-22 15:06:32] andrew at digicol dot de
PHP version seems to be irrelevant, but I was forced to choose a
version because of the bug category. I couldn't find the versions I
tried it on (4.3.9, 5.2.0) in the version drop-down.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/40893
--
Edit this bug report at http://bugs.php.net/?id=40893&edit=1