bug-coreutils
[Top][All Lists]
Advanced

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

Re: Surprising bug in sort


From: Eric Blake
Subject: Re: Surprising bug in sort
Date: Sun, 17 Aug 2008 21:25:00 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to address@hidden on 8/17/2008 9:11 PM:
> Hi there,
> 
> I ran into a very surprising bug in the Windows cygwin sort routine:
> 
> I'm running GNU coreutils 6.9.92.4-f088d-dirtJanuary 2008  on  Windows XP 
> Service Pack 2.

That's not really the version of sort, but the string in the sort manpage
(and that bug in man-page generation has since been fixed); you are really
using sort 6.10 (as can be seen by sort --version).  I'd recommend using
the latest stable release 6.12, except that I maintain the cygwin port of
coreutils and haven't yet ported 6.12 to cygwin 1.5.x (only to the
experimental cygwin 1.7.0).

> 
> If I use the sort command: 
>         sort --stable -k2 -k9r 
> the data is not sorted correctly - the two pairs of lines containing the 
> same timestamp (14:09:16,806, and 14:09:17,141) are incorrectly reversed 
> in order so that the Exiting line comes before the Starting line - despite 
> the -k9r sort key. 

This is not a bug in sort, but a misunderstanding on your part.  -k2
requests using as a key all text starting from the second field and ending
at the end of the line.  But it sounds like you want to sort based on just
the text in the second field, without regards to subsequent fields, that is:

sort --stable -k2,2

> 
> CAUTION - This message may contain privileged and confidential information 

It is considered poor netiquette to send email with unenforceable
disclaimers to publicly archived lists.  Some people refuse on principle
to reply to such mail.  You may want to consider using an alternate email
if your employer adds this to your mail after the fact.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkio64wACgkQ84KuGfSFAYCXdgCeIfOKQul4R6fb9o6NQkgnX5qE
/fsAn2SX1555m0X12+A3wSj2LwGW8PMg
=gaFM
-----END PGP SIGNATURE-----




reply via email to

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