coreutils
coreutils copied to clipboard
fix: df: filter filesystem types after mount point resolution
This PR fixes #6194 .
When df receives both a -t type filter and file paths, the mount point for each path must be determined before the filesystem type filter is applied.
The cause of this bug was that the filtering was applied at https://github.com/uutils/coreutils/blob/e147063e26c42647f9b3b6cf018ac5dfe11183da/src/uu/df/src/df.rs#L387 before the mount point was determined at https://github.com/uutils/coreutils/blob/e147063e26c42647f9b3b6cf018ac5dfe11183da/src/uu/df/src/df.rs#L403
This led to mount points being incorrectly determined for paths in some cases. For instance, on MacOS cargo run df -a -t apfs /dev would print the mount point at /. More examples are given in #6194
The fix was to re-order filtering and mount point resolution.
Could you please add a test to make sure we don't regress? See https://github.com/uutils/coreutils/blob/main/tests/by-util/test_df.rs for example
@sylvestre I have now added coverage by expanding an existing test, let me know what you think. I assumed that /dev has its own mount point with a different filesystem type to / - should be a safe assumption on Linux, macOS and I think Android.
GNU testsuite comparison:
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
This may also fix issue #6073 which relates to nested mounts having different filesystem types
sorry but could you please rebase the patch ? sorry again
GNU testsuite comparison:
Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)
GNU testsuite comparison:
Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
@sylvestre done
thanks and sorry for the latency!