[php-src] Issue #8048: disk_*_space uses statvfs on macOS and it returns inaccruate results for some filesystems
| From: | risner | Date: | Sun, 06 Feb 2022 21:33:18 +0000 |
| Subject: | [php-src] Issue #8048: disk_*_space uses statvfs on macOS and it returns inaccruate results for some filesystems | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239517@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8048
Author: risner
### Description
The following code:
```php
<?php print disk_total_space("/nfs1") . "\n";?>
```
Resulted in this output:
```
198919206912
```
But I expected this output instead:
```
60518056220
```
The code works correctly for local filesystems, and fails on NFS.
If I remember correctly the posix standard is not required to provide correct information. Should
php never be using the statvfs call?
Data points for NFS:
php total 198919206912
correct total 30985244784640
df total 30259028110
vfs total 194257038
fs f_bsize 512 vfs 1048576
fs f_iosize 1048576 vfs f_frsize 512
fs f_blocks 60518056220 vfs 388514076
fs f_bfree 20573829227 vfs 3393960043
fs f_bavail 20573829227 vfs 3393960043
Data points for local:
php total 245107195904 vfs 245107195904
correct total 245107195904
df total 3496966385312
vfs total 3496966385312
fs f_bsize 4096 vfs 1048576
fs f_iosize 1048576 vfs f_frsize 4096
fs f_blocks 59840624 vfs 59840624
fs f_bfree 5153807 vfs 5153807
fs f_bavail 5153807 vfs 5153807
### PHP Version
PHP 7.4
### Operating System
macOS 12.1