df: fix incorrect Available and Use% on windows
Close #7461
Test
GNU testsuite comparison:
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)
Did you see that some df tests fail on Windows in the CI?
Did you see that some
dftests fail on Windows in the CI?
Hi, sorry for the late reply.
I ran the same test command locally, but all the test_df ::* tests passed. However, I noticed that the CI reports failures on Windows. I’m currently investigating the root cause—do you have any insights on what might be different in the CI environment?
For reference, here is the test output from my local run:
❯ cargo nextest run --hide-progress-bar --profile ci --features=feat_os_windows test_df 2>&1 | Select-String -NotMatch 'SKIP'
Finished `test` profile [unoptimized + debuginfo] target(s) in 0.72s
Nextest run ID 9c4d623b-24fd-43e0-988a-d98c18bed72d with nextest profile: ci
PASS [ 0.040s] coreutils::tests test_df::test_output_field_no_more_than_once
PASS [ 0.042s] coreutils::tests test_df::test_df_compatible_type
PASS [ 0.047s] coreutils::tests test_df::test_df_compatible
PASS [ 0.053s] coreutils::tests test_df::test_df_compatible_no_size_arg
PASS [ 0.058s] coreutils::tests test_df::test_exclude_type_option
PASS [ 0.066s] coreutils::tests test_df::test_df_compatible_sync
PASS [ 0.076s] coreutils::tests test_df::test_invalid_arg
PASS [ 0.079s] coreutils::tests test_df::test_default_block_size_in_posix_portability_mode
PASS [ 0.102s] coreutils::tests test_df::test_df_shortened_long_argument
PASS [ 0.107s] coreutils::tests test_df::test_df_output
PASS [ 0.132s] coreutils::tests test_df::test_df_compatible_si
PASS [ 0.162s] coreutils::tests test_df::test_exclude_all_types
PASS [ 0.202s] coreutils::tests test_df::test_block_size_from_env_precedences
PASS [ 0.202s] coreutils::tests test_df::test_df_output_overridden
PASS [ 0.203s] coreutils::tests test_df::test_output_file_all_filesystems
PASS [ 0.210s] coreutils::tests test_df::test_default_headers
PASS [ 0.218s] coreutils::tests test_df::test_ignore_block_size_from_env_in_posix_portability_mode
PASS [ 0.220s] coreutils::tests test_df::test_iuse_percentage
PASS [ 0.224s] coreutils::tests test_df::test_block_size_from_env
PASS [ 0.225s] coreutils::tests test_df::test_invalid_block_size_from_env
PASS [ 0.188s] coreutils::tests test_df::test_output_multiple_occurrences
PASS [ 0.185s] coreutils::tests test_df::test_output_option_without_equals_sign
PASS [ 0.242s] coreutils::tests test_df::test_invalid_block_size_suffix
PASS [ 0.184s] coreutils::tests test_df::test_precedence_of_block_size_arg_over_env
PASS [ 0.243s] coreutils::tests test_df::test_include_exclude_same_type
PASS [ 0.244s] coreutils::tests test_df::test_default_block_size
PASS [ 0.168s] coreutils::tests test_df::test_total
PASS [ 0.143s] coreutils::tests test_df::test_total_option_with_single_dash
PASS [ 0.256s] coreutils::tests test_df::test_invalid_block_size
PASS [ 0.259s] coreutils::tests test_df::test_order_same
PASS [ 0.097s] coreutils::tests test_df::test_use_percentage
PASS [ 0.259s] coreutils::tests test_df::test_output_conflict_options
PASS [ 0.271s] coreutils::tests test_df::test_df_output_arg
PASS [ 0.201s] coreutils::tests test_df::test_too_large_block_size
PASS [ 0.259s] coreutils::tests test_df::test_output_option
PASS [ 0.303s] coreutils::tests test_df::test_block_size_in_posix_portability_mode
PASS [ 0.251s] coreutils::tests test_df::test_output_selects_columns
PASS [ 0.046s] coreutils::tests test_df::test_used_header_starts_with_space
PASS [ 0.268s] coreutils::tests test_df::test_precedence_of_human_readable_and_si_header_over_output_header
PASS [ 0.240s] coreutils::tests test_df::test_total_label_in_correct_column
PASS [ 0.210s] coreutils::tests test_df::test_type_option
PASS [ 0.354s] coreutils::tests test_df::test_df_conflicts_overriding
PASS [ 0.425s] coreutils::tests test_df::test_block_size_1024
PASS [ 0.485s] coreutils::tests test_df::test_df_arguments_override_themselves
PASS [ 0.496s] coreutils::tests test_df::test_block_size_with_suffix
Also, I’ve been quite busy lately, so my progress on this might be a bit slow. I’ll try to look into it as soon as I can. Thanks for your patience!