Bug 901517

Summary: is not this sorting incorrect?
Product: [Fedora] Fedora Reporter: Ales Ledvinka <aledvink>
Component: coreutilsAssignee: Ondrej Vasik <ovasik>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: admiller, kdudka, kzak, ovasik, pbrady, p, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-18 11:38:55 EST Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Ales Ledvinka 2013-01-18 06:32:18 EST
Is not the sort broken or did I miss some option?

Below is the patch file. The update was generated by a script. Though I can not guarantee that the original file from several months or years ago was generated by the same script but it seems it might be.

I tried to use different sort options and combine that with either field separator ":" or no separator option but was unable to produce the original sorting order to reduce the patch size. The new sort order seems to be rather incorrect to move the 0:0:1 past 0:0:1f on numeric sort on both field separator : or no separator.

diff -up ./ethercodes.dat.orig ./ethercodes.dat
--- ./ethercodes.dat.orig       2013-01-18 11:31:10.998394976 +0100
+++ ./ethercodes.dat    2013-01-18 11:45:28.466851677 +0100
@@ -1,5 +1,4 @@
 0:0:0  XEROX CORPORATION
-0:0:1  XEROX CORPORATION
 0:0:10 SYTEK INC.
 0:0:11 NORMEREL SYSTEMES
 0:0:12 INFORMATION TECHNOLOGY LIMITED
@@ -16,7 +15,7 @@
 0:0:1d CABLETRON SYSTEMS, INC.
 0:0:1e TELSIST INDUSTRIA ELECTRONICA
 0:0:1f Telco Systems, Inc.
-0:0:2  XEROX CORPORATION
+0:0:1  XEROX CORPORATION
 0:0:20 DATAINDUSTRIER DIAB AB
 0:0:21 SUREMAN COMP. & COMMUN. CORP.
 0:0:22 VISUAL TECHNOLOGY INC.
@@ -33,7 +32,7 @@
 0:0:2d CHROMATICS INC
 0:0:2e SOCIETE EVIRA
 0:0:2f TIMEPLEX INC.
-0:0:3  XEROX CORPORATION
+0:0:2  XEROX CORPORATION
 0:0:30 VG LABORATORY SYSTEMS LTD
 0:0:31 QPSX COMMUNICATIONS PTY LTD
 0:0:32 Marconi plc
Comment 1 Pádraig Brady 2013-01-18 07:04:08 EST
sounds like a locale issue.
Try with: LC_ALL=C sort ...

Note sorting variable width hex is not directly supported by sort unfortunately
Comment 2 Ondrej Vasik 2013-01-18 11:38:55 EST
It would be better to have the original files rather than the patch, still, I don't see a bug in sort here. As Pádraig said, locales influence the sorting order.