From 4ae4ae9fae582eda929c16a2df9d8332c8de10e3 Mon Sep 17 00:00:00 2001 From: Bryan Gardiner Date: Sun, 29 Sep 2024 17:07:26 -0700 Subject: [PATCH] Fall back to sorting by name, if all else is equal. --- src/nvd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nvd b/src/nvd index 8fa4bd0..fd0a571 100755 --- a/src/nvd +++ b/src/nvd @@ -500,7 +500,10 @@ class PackageListEntryCombinedComparator(PackageListEntryComparator): if result != 0: return result - return 0 + # Fall back to applying the default sort, if none of the requested + # comparators have found any difference. Without this, packages may + # appear in nondeterministic order. + return DEFAULT_SORT.cmp_packages(a, b) def reversed(self) -> PackageListEntryComparator: return PackageListEntryCombinedComparator(c.reversed() for c in self._comparators)