[Bug 241679] /usr/bin/sort fails if UTF-8 input is received from stdin

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 07 Jun 2022 18:33:22 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241679

Andreas Baumgärtner <andreas.baumgaertner@tisco.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andreas.baumgaertner@tisco.
                   |                            |at

--- Comment #5 from Andreas Baumgärtner <andreas.baumgaertner@tisco.at> ---
Here is how to reproduce the issue:

FreeBSD 12.3-RELEASE-p2
FreeBSD 12.3-RELEASE-p5

host: /tmp# echo $LANG
en_US.UTF-8
host: /tmp# cat a | sort
sort: Illegal byte sequence
host: /tmp# cut -d" " -f 1 a
cut: a: Illegal byte sequence
host: /tmp# sort a
gelöscht
host: /tmp# sort a > b
host: /tmp# diff a b
1c1
< gel▒scht
---
> gelöscht
host: /tmp# file a b
a: ISO-8859 text
b: UTF-8 Unicode text
host: /tmp# hexdump -c a
0000000   g   e   l   ▒   s   c   h   t  \n
0000009
host: /tmp# hexdump -c b
0000000   g   e   l   ▒   ▒   s   c   h   t  \n
000000a
host: /tmp# hexdump -x a
0000000    6567    f66c    6373    7468    000a
0000009
host: /tmp# hexdump -x b
0000000    6567    c36c    73b6    6863    0a74
000000a
host: /tmp# ls -l a b
-rw-r--r--  1 root  wheel   9 Jun  7 20:11 a
-rw-r--r--  1 root  wheel  10 Jun  7 20:20 b
host: /tmp# 

my initial issue was with a directory (here in reverse to reproduce)
host: /tmp# mkdir `cat a`
host: /tmp# find . -type d | sort
sort: Illegal byte sequence
host: /tmp# rmdir gel\366scht/
host: /tmp# 

I'm unable to re-open the bug from here.

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