Fixed GH-8048: Force macOS to use statfs. #8056
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A macOS bug in libc statvfs(3) call truncates 64 bit elements (e.g. f_blocks) to 32 bits.
Tested in [email protected], but it is a clean patch against the current.
t.php:
echo "Total: " . disk_total_space("/Volumes/Data/H1/tank"), PHP_EOL;
echo "Free: " . disk_free_space("/Volumes/Data/H1/tank"), PHP_EOL;
Test results:
mbpm1# df -k/Volumes/Data/H1/tank
Filesystem 1024-blocks Used Available Capacity iused ifree %iused Mounted on
h1:/tank 30259027086 21624936060 8634091026 72% 218 17268182053 0% /System/Volumes/Data/H1/tank
mbpm1# php t.php
Total: 30985243736576
Free: 8841309211136
30985243736576 ~ 302590270861024 off by 512.
8841309211136 ~ 86340910261024 also off by 512.