df(windows): fix Avail/Use% by using number_of_free_clusters for bavail#9470
Open
naoNao89 wants to merge 1 commit intouutils:mainfrom
Open
df(windows): fix Avail/Use% by using number_of_free_clusters for bavail#9470naoNao89 wants to merge 1 commit intouutils:mainfrom
naoNao89 wants to merge 1 commit intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
Contributor
|
could you please add a test to make sure we don't regress in the future? thanks |
9d81e88 to
57198e8
Compare
Contributor
Author
|
done |
|
GNU testsuite comparison: |
Contributor
|
@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: |
a02989f to
d8a882b
Compare
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
d8a882b to
37f3d7a
Compare
|
GNU testsuite comparison: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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