Bug 509688 - 'sort --version-sort' is ignored.
Summary: 'sort --version-sort' is ignored.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 11
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-07-05 05:53 UTC by Bruce Jerrick
Modified: 2009-07-24 19:39 UTC (History)
3 users (show)

Fixed In Version: 7.2-2.fc11
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-07-24 19:39:15 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Bruce Jerrick 2009-07-05 05:53:58 UTC
Description of problem:
The --version-sort (-V) option of sort(1) is not honored in multibyte
locales.

Version-Release number of selected component (if applicable):
coreutils-7.2-1.fc11

How reproducible:
100%

Steps to Reproduce:
1. { echo "narf.9"; echo "narf.10"; } | sort --version-sort
  
Actual results (just a lexical sort):
narf.10
narf.9

Expected results (sorted ala 'ls -v'):
narf.9
narf.10

Additional info:
Detection of key->version was apparently inadvertently omitted
from keycompare_mb() (it is in keycompare_uni() ).
Fix is simply to clone it from the latter:

diff -urp coreutils-7.2.orig/src/sort.c coreutils-7.2/src/sort.c
--- coreutils-7.2.orig/src/sort.c	2009-07-01 23:24:30.000000000 -0700
+++ coreutils-7.2/src/sort.c	2009-07-02 01:16:45.000000000 -0700
@@ -2508,6 +2508,8 @@ keycompare_mb (const struct line *a, con
 		(texta, textb));
 	  *lima = savea, *limb = saveb;
 	}
+      else if (key->version)
+	diff = compare_version (texta, lena, textb, lenb);
       else if (key->month)
 	diff = getmonth (texta, lena) - getmonth (textb, lenb);
       else

Comment 1 Kamil Dudka 2009-07-05 06:34:49 UTC
Thank you for the report and the patch! I can confirm the bug and that it is fixed by the patch.

Comment 2 Ondrej Vasik 2009-07-06 21:50:18 UTC
Thanks for report (and patch). Fixed in Rawhide and built as coreutils-7.4-3.fc12, there are already few bugs fixed in rawhide, so will do cumulative F-11 (and maybe F-10) coreutils update soon. Damned multibyte patch, I'm quite sure there are more such things, probably have to check it.

Comment 3 Fedora Update System 2009-07-08 14:59:13 UTC
coreutils-7.2-2.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/coreutils-7.2-2.fc11

Comment 4 Fedora Update System 2009-07-16 07:18:45 UTC
coreutils-7.2-2.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update coreutils'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-7643

Comment 5 Fedora Update System 2009-07-24 19:39:10 UTC
coreutils-7.2-2.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.