Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 54765 - sort by month name using sort from coreutils (option -M) doesn't work
Summary: sort by month name using sort from coreutils (option -M) doesn't work
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Seemant Kulleen (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-22 10:22 UTC by Thomas Petersen
Modified: 2004-11-27 05:49 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Petersen 2004-06-22 10:22:00 UTC
Sorting a simple textfile containing month names with sort and option -M doesn't sort as expected. It seems like it simply sorts it alphabetically instead unless the -s option is also specifien in which case it doesn't do any sorting at all. I have tested this with sort 5.2.0 and sort 5.0.91 and is doesn't work in either of them. However with an old version 2.1 of sort from the textutils package it works perfectly. I have tested this on an older gentoo installation from that time where textutils was installed by default instead of coreutils.

Reproducible: Always
Steps to Reproduce:
1. Create a textfile containing monthnames. Example:
May
JAN
Apr
Foobar
March
Jun
FEB

2. sort it by executing:
sort -M -s testfil

3. Examine the result.

Actual Results:  
May
JAN
Apr
Foobar
March
Jun
FEB


Expected Results:  
Foobar
JAN
FEB
March
Apr
May
Jun


Copying the older version of sort from my old gentoo installation to a new 
machine works. I think that indicates that it isn't a problem in some libraries 
(glibc) but in the sort program itself.

The manpage mentions something about environment variables LC_ALL, LC_TIME and 
others. I have tried setting these to different values like C and en_US in 
different combinations but it doesn't do anything.
Comment 1 Seemant Kulleen (RETIRED) gentoo-dev 2004-07-02 16:16:16 UTC
one of the patches is causing this disturbing behaviour -- investigating.
Comment 2 Martin Flugeldufel 2004-07-04 16:44:21 UTC
Also confirmed not working in 5.2.1.
Comment 3 bartron 2004-07-04 18:27:55 UTC

    
Comment 4 bartron 2004-07-04 18:27:55 UTC
 
   Hm...seems to me it's a small typo in the `i18n' patch.  `Sort' keeps 
a table of month names in the current locale, converted to upper case 
(initialized in `inittables()').  However... with `i18n' applied, this 
initialization is done in `inittables_mb()'... the month names chars are 
converted to uppercase (pwc), but the unconverted characters (wc) are 
stored in `monthtab'.

   Line 2573 in `coreutils-5.2.1-i18n-0.1.patch',

        mblength = wcrtomb (mbc, wc, &state_wc);

should be

        mblength = wcrtomb (mbc, pwc, &state_wc);


   Line numbers in older versions,

    coreutils-5.0.91-i18n-0.2.patch, 2671
    coreutils-5.2.0-i18n-0.1.patch, 2573
Comment 5 Martin Flugeldufel 2004-07-09 22:22:33 UTC
200
Comment 6 Seemant Kulleen (RETIRED) gentoo-dev 2004-07-09 23:45:20 UTC
I'll get a new revision out shortly with a fixed patchset + a new selinux patchset

ETA: 1 day
Comment 7 Seemant Kulleen (RETIRED) gentoo-dev 2004-07-12 21:53:01 UTC
coreutils-5.2.1-r1 fixes this.
Comment 8 Thomas Petersen 2004-11-27 05:49:09 UTC
coreutils-5.2.1 is still the latest version marked stable on x86 so most gentoo systems still contain this bug.