Bug 509688 - 'sort --version-sort' is ignored.
'sort --version-sort' is ignored.
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2009-07-05 01:53 EDT by Bruce Jerrick
Modified: 2009-07-24 15:39 EDT (History)
3 users (show)

See Also:
Fixed In Version: 7.2-2.fc11
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-07-24 15:39:15 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Bruce Jerrick 2009-07-05 01:53:58 EDT
Description of problem:
The --version-sort (-V) option of sort(1) is not honored in multibyte

Version-Release number of selected component (if applicable):

How reproducible:

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

Expected results (sorted ala 'ls -v'):

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);
Comment 1 Kamil Dudka 2009-07-05 02:34:49 EDT
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 17:50:18 EDT
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 10:59:13 EDT
coreutils-7.2-2.fc11 has been submitted as an update for Fedora 11.
Comment 4 Fedora Update System 2009-07-16 03:18:45 EDT
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 15:39:10 EDT
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.