Skip to content

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

Merged
sylvestre merged 2 commits into
uutils:mainfrom
jfinkels:df-same-order
Feb 13, 2022
Merged

sylvestre merged 2 commits into
uutils:mainfrom
jfinkels:df-same-order

Conversation

@jfinkels

Copy link
Copy Markdown
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
Copy Markdown
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