Bug 127694

Summary: sort -kx -kybn does not sort numerically on key y
Product: [Fedora] Fedora Reporter: Graham King <rhbugzilla>
Component: coreutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: 5.2.1-18 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-07-13 13:44:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Graham King 2004-07-12 17:25:11 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510

Description of problem:
When sorting on two keys, the "n" (numeric) flag on the second key is
not honoured.

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

How reproducible:

Steps to Reproduce:
1.data="b      0
b     88
a      0
a  17454
a   2338"

2. echo "$data" | sort -k1,1 -k2bn,2

Actual Results:  
a      0
a  17454
a   2338
b      0
b     88

Expected Results:  
a      0
a   2338
a  17454
b      0
b     88

Additional info:

I have tried various other, equivalent, syntaxes for specifying the
keys, and various input data.  The bug is consistently reproducible.

Note that 
echo "$data" | sort -k2bn,2
does sort numerically, as expected.

Comment 1 Graham King 2004-07-12 19:37:38 UTC
The following work-round works:

echo "$data" | LC_ALL=C sort -k4,4  -k5bn,5

Thanks to http://www.tinyvital.com/techblog/archives/000332.html

(for info, 
env | grep LC
returned nothing in my environment.)

Comment 2 Tim Waugh 2004-07-13 13:44:31 UTC
This was a bug in the i18n patch.  Fixed in 5.2.1-18.  Thanks for the