Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

df: always produce the same order in output table #3126

Merged
merged 2 commits into from
Feb 13, 2022

Conversation

jfinkels
Copy link
Collaborator

This pull request changes the filter_mount_list() function so that it always produces the same order of MountInfo objects. This change ultimately results in df printing its table of filesystems in the same order on each execution. Previously, the table was in an arbitrary order because the MountInfo objects were read from a HashMap.

Fixes #3086.

Factor two helper functions, `is_included()` and `mount_info_lt()`,
from the `filter_mount_list()` function.
Change the `filter_mount_list()` function so that it always produces
the same order of `MountInfo` objects. This change ultimately results
in `df` printing its table of filesystems in the same order on each
execution. Previously, the table was in an arbitrary order because the
`MountInfo` objects were read from a `HashMap`.

Fixes uutils#3086.
@sylvestre
Copy link
Contributor

much better code, thanks!

@sylvestre sylvestre merged commit bd47c06 into uutils:main Feb 13, 2022
@jfinkels jfinkels deleted the df-same-order branch February 28, 2022 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

df: rows appear in different order on each execution, but shouldn't
2 participants