[Bug 1081683] Re: sort inconsistent

Colin Watson cjwatson at canonical.com
Wed Nov 28 02:55:12 UTC 2012


This is a consequence of the locale you're in following the collation
rules of ISO/IEC 14651:2011 (you can download a copy from
http://standards.iso.org/ittf/PubliclyAvailableStandards/index.html).
Once you dig through the syntax, this specifies that U+002E (".") is an
"ignorable" character for the purposes of ordering, so it's only
considered if the strings are otherwise equivalent.

This kind of algorithm generally fits natural-language ordering somewhat
better, so it's used for most natural-language locales in libc, but of
course isn't suitable for ordering things that care more about
ASCIIbetical ordering.  If you want that, then you should set this
environment variable:

  LC_COLLATE=C

** Package changed: coreutils (Ubuntu) => eglibc (Ubuntu)

** Changed in: eglibc (Ubuntu)
       Status: New => Won't Fix

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to eglibc in Ubuntu.
https://bugs.launchpad.net/bugs/1081683

Title:
  sort inconsistent

Status in “eglibc” package in Ubuntu:
  Won't Fix

Bug description:
  In the following examples, I expect /usr/bin/sort to always put '.'
  (0x2E) before 'a' (0x61)

  $ echo -e 'ab\naa\n.a' |sort
  .a
  aa
  ab

  $ echo -e 'aba\naaa\n.aa' |sort
  .aa
  aaa
  aba

  $ echo -e 'abb\naaa\n.ab' |sort
  aaa
  .ab
  abb

  The difference between examples 2 and 3 is the third byte of each line
  is one bit higher, and for some reason this makes the first byte "."
  simultaneously after "a" and before "a" in sort order.  That's should
  be contradictory, and this is repeatable.

  This also happens when other punctuation marks are the first byte (remember 'a' is 0x61)
  $ echo -e 'abb\naaa\n!ab' |sort  # ! = 0x21
  $ echo -e 'abb\naaa\n_ab' |sort # _ = 0x5F
  $ echo -e 'abb\naaa\n{ab' |sort # { = 0x7B , so not only for bytes that are  < 0x61

  ProblemType: Bug
  DistroRelease: Ubuntu 12.10
  Package: coreutils 8.13-3.2ubuntu2
  ProcVersionSignature: Ubuntu 3.5.0-18.29-generic 3.5.7
  Uname: Linux 3.5.0-18-generic i686
  NonfreeKernelModules: nvidia
  ApportVersion: 2.6.1-0ubuntu6
  Architecture: i386
  Date: Wed Nov 21 11:32:54 2012
  MarkForUpload: True
  SourcePackage: coreutils
  UpgradeStatus: Upgraded to quantal on 2012-10-19 (32 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1081683/+subscriptions




More information about the foundations-bugs mailing list