#988982 apt-utils: does not sort the numbers correctly. Should be smallest to largest.

#988982#5
Date:
2021-05-22 14:03:11 UTC
From:
To:
Dear Maintainer,

the command `apt-utils-search` does not sort the numbers based on integer value
from smallest to largest.

How to reproduce:
-----------------
 1. M-x apt-utils-search
 2. Search packages for regexp: google-android-platform


The current sorted result:
-------------------------
google-android-platform-10-installer - Google's Android SDK Platform 10
Installer
google-android-platform-11-installer - Google's Android SDK Platform 11
Installer
google-android-platform-12-installer - Google's Android SDK Platform 12
Installer
google-android-platform-13-installer - Google's Android SDK Platform 13
Installer
google-android-platform-14-installer - Google's Android SDK Platform 14
Installer
google-android-platform-15-installer - Google's Android SDK Platform 15
Installer
google-android-platform-16-installer - Google's Android SDK Platform 16
Installer
google-android-platform-17-installer - Google's Android SDK Platform 17
Installer
google-android-platform-18-installer - Google's Android SDK Platform 18
Installer
google-android-platform-19-installer - Google's Android SDK Platform 19
Installer
google-android-platform-2-installer - Google's Android SDK Platform 2 Installer
google-android-platform-20-installer - Google's Android SDK Platform 20
Installer
google-android-platform-21-installer - Google's Android SDK Platform 21
Installer
google-android-platform-22-installer - Google's Android SDK Platform 22
Installer
google-android-platform-23-installer - Google's Android SDK Platform 23
Installer
google-android-platform-24-installer - Google's Android SDK Platform 24
Installer
google-android-platform-3-installer - Google's Android SDK Platform 3 Installer
google-android-platform-4-installer - Google's Android SDK Platform 4 Installer
google-android-platform-5-installer - Google's Android SDK Platform 5 Installer
google-android-platform-6-installer - Google's Android SDK Platform 6 Installer
google-android-platform-7-installer - Google's Android SDK Platform 7 Installer
google-android-platform-8-installer - Google's Android SDK Platform 8 Installer
google-android-platform-9-installer - Google's Android SDK Platform 9 Installer


The expected sorted result:
---------------------------
google-android-platform-2-installer - Google's Android SDK Platform 2 Installer
google-android-platform-3-installer - Google's Android SDK Platform 3 Installer
google-android-platform-4-installer - Google's Android SDK Platform 4 Installer
google-android-platform-5-installer - Google's Android SDK Platform 5 Installer
google-android-platform-6-installer - Google's Android SDK Platform 6 Installer
google-android-platform-7-installer - Google's Android SDK Platform 7 Installer
google-android-platform-8-installer - Google's Android SDK Platform 8 Installer
google-android-platform-9-installer - Google's Android SDK Platform 9 Installer
google-android-platform-10-installer - Google's Android SDK Platform 10
Installer
google-android-platform-11-installer - Google's Android SDK Platform 11
Installer
google-android-platform-12-installer - Google's Android SDK Platform 12
Installer
google-android-platform-13-installer - Google's Android SDK Platform 13
Installer
google-android-platform-14-installer - Google's Android SDK Platform 14
Installer
google-android-platform-15-installer - Google's Android SDK Platform 15
Installer
google-android-platform-16-installer - Google's Android SDK Platform 16
Installer
google-android-platform-17-installer - Google's Android SDK Platform 17
Installer
google-android-platform-18-installer - Google's Android SDK Platform 18
Installer
google-android-platform-19-installer - Google's Android SDK Platform 19
Installer
google-android-platform-20-installer - Google's Android SDK Platform 20
Installer
google-android-platform-21-installer - Google's Android SDK Platform 21
Installer
google-android-platform-22-installer - Google's Android SDK Platform 22
Installer
google-android-platform-23-installer - Google's Android SDK Platform 23
Installer
google-android-platform-24-installer - Google's Android SDK Platform 24
Installer


Thanks, Salman

#988982#10
Date:
2021-05-22 14:48:50 UTC
From:
To:
Salman Mohammadi <salman@smoha.org> writes:

Since the function does not promise any particular order, and the order
matches "apt search" on the command line, this seems more like a request
for an enhancement. I guess sorting by version might be possible,
although not trivial due to versions being complicated. Sorting by some
number embedded in the package name sounds messy.

d

#988982#17
Date:
2021-05-23 15:21:00 UTC
From:
To:
integer value
Salman, are you asking for a natural short, like piping a newline separated
list to "sort -V" would provide?  I think this is what you're asking for.

David, AFAIK Emacs doesn't yet provide a natural sort algorithm, but is
there any reason why it wouldn't be a good idea to pass the data to "sort
-V" before outputting to the *APT package info* buffer?  I guess there's
also the question of if a non-interactive call to apt-utils-search should
return a natural sorted list...

But isn't the big question:  If a user-friendly natural sorted list is a
reasonable expectation, shouldn't "apt (and aptitude) search" do this
directly?  Better to fix it there, rather than in a way specific to
debian-el, no?

Cheers,
Nicholas

#988982#22
Date:
2021-05-23 16:43:17 UTC
From:
To:
Hi Nicholas,

I didn't mean exactly something like "sort -V" but an order in which
something-here-24 does not fall behind something-here-3. My mistake was
that I hadn't checked `apt search` for this behavior before filing a bug
here. Apt gives the same order.

Here is the related bug, https://bugs.debian.org/681164 and already
labeled as 'wontfix'.


Thanks, Salman