Bug 1322888

Summary: dnf output lines are sorted by *length* of package names, not alphabetically
Product: [Fedora] Fedora Reporter: Armin Jenewein <syntaxdog>
Component: dnfAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: jsilhan, mluscon, packaging-team-maint, pnemade, vmukhame
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-08 01:37:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Here is a screenshot showcasing the problem none

Description Armin Jenewein 2016-03-31 14:22:04 UTC
Created attachment 1142239 [details]
Here is a screenshot showcasing the problem

Description of problem:
dnf output lines are sorted by *length* of package names, not alphabetically

Version-Release number of selected component (if applicable):
1.1.7
  Installed: dnf-0:1.1.7-2.fc23.noarch at 2016-03-24 12:44
  Built    : Fedora Project at 2016-03-09 16:45

  Installed: rpm-0:4.13.0-0.rc1.12.fc23.x86_64 at 2016-03-24 12:43
  Built    : Fedora Project at 2016-02-29 09:53

How reproducible:
"dnf search <foobar>"

Actual results:
Output lines are sorted by the *length* of package names (see attached screenshot).

Expected results:
Results should be sorted in some way.

Comment 1 Honza Silhan 2016-04-04 11:42:43 UTC
The output is sorted by different heuristic. The more relevant result, the more to the top. I.e. is the string inside summary, description, pkgname, etc.

Sort by the length in your case is just coincidence.

Comment 2 Armin Jenewein 2016-04-05 22:51:13 UTC
Hi.

You are relating to the sorting of the type of match. What I'm trying to report here is the sorting *within* those groups. The groups are sorted, their contents are not.

To reproduce, just do a "yum search x" for example. You'll see 2 groups scrolling down, the first one being the match of the package names, the second one the descriptions. I would agree that showing the group of package names is more relevant, but shouldn't the inner package names be sorted in some different way than the length of the package name!?

Hence, re-opening.

Armin

Comment 3 Armin Jenewein 2016-04-05 22:52:58 UTC
s/yum/dnf/g - I just got used to it, my apologies. :-)

Comment 4 Armin Jenewein 2016-04-08 01:37:01 UTC
Hi.

Took me some time to understand what the relevance means in this context and it makes sense to me. Still a pretty confusing behaviour, and it constantly leads me to use mad constructs like 

sudo yum search x | grep -E '^[a-zA-Z0-9]' | sort | less -R

for example. 

I think one could debate the implementation of an optional alphabetical sort, but I have to agree with you, Jan.

Jan, thanks a lot for your help and your understanding. Closing this bug-report.

- Armin