[Bug 247494] sort(1) order affected by LC_CTYPE

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Jun 23 07:30:21 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247494

            Bug ID: 247494
           Summary: sort(1) order affected by LC_CTYPE
           Product: Base System
           Version: 12.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: knu at FreeBSD.org

My understanding is it is LC_COLLATE that affects how sort(1) compares
characters
and the C locale has the collation for binary comparison, so I set LC_COLLATE=C
when calling sort(1) for language independent sorting, but it seems LC_CTYPE
also
affects how sort(1) works.

% (echo 耳 ; echo 脳 ; echo 耳) | LC_CTYPE=ja_JP.UTF-8 LC_COLLATE=C LANG=C sort
耳
脳
耳

% (echo 耳 ; echo 脳 ; echo 耳) | LC_CTYPE=C LC_COLLATE=C LANG=C sort
耳
耳
脳


For reference, GNU sort works fine with any LC_CTYPE, and according to a NetBSD
user
the same goes for NetBSD sort.

% (echo 耳 ; echo 脳 ; echo 耳) | LC_CTYPE=ja_JP.UTF-8 LC_COLLATE=C LANG=C gsort
耳
耳
脳


Is this a bug or by design?

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list