df(windows): fix Avail/Use% by using number_of_free_clusters for bavail#9470
df(windows): fix Avail/Use% by using number_of_free_clusters for bavail#9470naoNao89 wants to merge 1 commit intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
|
could you please add a test to make sure we don't regress in the future? thanks |
9d81e88 to
57198e8
Compare
|
done |
|
GNU testsuite comparison: |
|
@naoNao89 i was thinking about tests/by-util/test_df.rs |
a388c9a to
94dd012
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
|
GNU testsuite comparison: |
94dd012 to
586f6b7
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
4df2522 to
0f996bb
Compare
|
GNU testsuite comparison: |
0f996bb to
8e04006
Compare
|
GNU testsuite comparison: |
d8a882b to
37f3d7a
Compare
|
GNU testsuite comparison: |
0316c4d to
e41963a
Compare
|
GNU testsuite comparison: |
tests/by-util/test_df.rs
Outdated
| "At least one filesystem should have non-zero available space. Got output:\n{}", | ||
| output |
There was a problem hiding this comment.
| "At least one filesystem should have non-zero available space. Got output:\n{}", | |
| output | |
| "At least one filesystem should have non-zero available space. Got output:\n{output}" | |
Fix Windows df incorrectly reporting 0 bytes available and 100% usage for all filesystems. The issue was caused by hardcoding bavail (blocks available to non-privileged processes) to 0 instead of using the actual free clusters from Windows API. Changes: - Set bavail to number_of_free_clusters on Windows (was: 0) - Add regression test test_windows_avail_column_not_zero Fixes uutils#7461
e41963a to
2fef881
Compare
|
GNU testsuite comparison: |
Fix Windows
dfincorrectly reporting 0 bytes available and 100% usage for all filesystems. The issue was caused by hardcodingbavail(blocks available to non-privileged processes) to 0 instead of using the actual free clusters from Windows API.On Windows, all mounted filesystems displayed:
This made
dfoutput useless for Windows users.Before (Broken)
After (Fixed)
Windows API Context
The fix correctly implements POSIX semantics on Windows:
f_bfreelpNumberOfFreeClusters(no quota consideration)f_bavaillpNumberOfFreeClusters(quota-aware)Windows
GetDiskFreeSpaceW()already respects disk quotas, making this fix semantically correct.Fixes
Closes #7461
Related Issues