bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17099: Does sort have a bug?


From: Leslie S Satenstein
Subject: bug#17099: Does sort have a bug?
Date: Wed, 26 Mar 2014 19:20:35 -0700 (PDT)

I fell into this problem as well about 5 weeks ago.

set the environment variable

....

export LC_ALL=C 
sort .....

and the proper collating sequence will prevail.

 
Regards 

 Leslie

Mr. Leslie Satenstein
SENT FROM MY OPEN SOURCE LINUX SYSTEM.




>________________________________
>
>
>$ sort --version
>sort (GNU coreutils) 5.97
>Copyright (C) 2006 Free Software Foundation, Inc.
>This is free software.  You may redistribute copies of it under the terms of
>the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
>There is NO WARRANTY, to the extent permitted by law.
>
>Written by Mike Haertel and Paul Eggert.
>----------------------------------------------------------------------------------------------------------
>(2) When I sort the following,
>
>     ../include/CcMsgFxStrm.h
>     ../include/CDesEncrypt.h
>     ../include/CEncrypt.h
>     include/CFixFX_Config.h
>     include/CFixFX_Handler.h
>     include/CFixFX_Server.h
>     ../include/CFxBaseMsg.h
>     include/CFXBookManager.h
>
>I am expecting for all the ../include's to bunch up before or after all 
>the include's.  But, the above is already in sorted order, according to 
>sort!  Something doesn't seem right.  Is there a bug?
>----------------------------------------------------------------------------------------------------------
>(3) If I write a C++ program as follows,
>
># include <cstdio>
># include <vector>
># include <iostream>
>using namespace std;
>
>int
>main ()
>{
>     vector<string> lines;
>     char buf[1024];
>     for (int i = 0; fgets (buf, sizeof buf, stdin); i++)
>         lines.push_back (buf);
>     for (int i = 0, sz = lines.size (); i < sz; i++)
>         for (int j = i + 1; j < sz; j++)
>             if (lines[j] < lines[i])
>             {
>                 string t = lines[i];
>                 lines[i] = lines[j];
>                 lines[j] = t;
>             }
>     for (int i = 0, sz = lines.size (); i < sz; i++)
>         cout << lines[i];
>}
>
>For the above input, I get the following output,
>
>     ../include/CDesEncrypt.h
>     ../include/CEncrypt.h
>     ../include/CFxBaseMsg.h
>     ../include/CcMsgFxStrm.h
>     include/CFXBookManager.h
>     include/CFixFX_Config.h
>     include/CFixFX_Handler.h
>     include/CFixFX_Server.h
>----------------------------------------------------------------------------------------------------------
>(4) Thanks for looking into this and sending me a reply.
>
>
>
>
>
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]