[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#37177: sort don't respect the ASCII order
From: |
Xavier Sanchez |
Subject: |
bug#37177: sort don't respect the ASCII order |
Date: |
Sat, 24 Aug 2019 23:15:17 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
Linux snake 5.2.0-2-amd64 #1 SMP Debian 5.2.9-2 (2019-08-21) x86_64 GNU/Linux
coreutils: 8.30-3+b1 on Debian 10
Hello, here's the test I'm using doing cross platforms verifications:
#!/bin/sh
seq() (
first=$1 incr=$2 last=$3
echo "for (i = $first; i <= $last; i+=$incr) i" | bc -l
)
_sha256() {
sha256sum 2>/dev/null || sha256
}
# shellcheck disable=SC2059
ascii_seq="$(
for i in $(seq 33 1 126); do
printf "\\$(printf %03o "$i")\\n"
done
)"
echo ASCII
printf %s\\n "$ascii_seq" | _sha256
echo SORT
printf %s\\n "$ascii_seq" | sort | _sha256
### end
--- >Resulsts:
Coreutils's 8.30-3+b1:
ASCII
d39a8797c560b434fe58e910a31c4e5454a6626602b7114a41509fa12792c1a2 -
SORT
d4225db1191701c182feba79f67d3b4d824bc8e90164d7fe55bdb3d34b71406d -
Busybox 1.30.1 (Alpine Linux):
ASCII
d39a8797c560b434fe58e910a31c4e5454a6626602b7114a41509fa12792c1a2 -
SORT
d39a8797c560b434fe58e910a31c4e5454a6626602b7114a41509fa12792c1a2 -
More explicit example:
Coreutils's 8.30-3+b1: find . | sort
.
./files
./files/$-e
./files/ascii1
./files/ascii2
./files/!-e
./files/#-e
./files/?-e
./files/empty1
./files/empty2
./files/filename with space
./files/subdir
./files/subdir/empty3
./files/subdir with space
./files/subdir with space/empty4
./tests.sh
Busybox 1.30.1 (Alpine Linux): find . | sort
.
./files
./files/!-e
./files/#-e
./files/$-e
./files/?-e
./files/ascii1
./files/ascii2
./files/empty1
./files/empty2
./files/filename with space
./files/subdir
./files/subdir with space
./files/subdir with space/empty4
./files/subdir/empty3
./tests.sh
I think something is broken in that version thus I did not verified one newer
ones but I think it's worth writing it there.
--
Xavier
- bug#37177: sort don't respect the ASCII order,
Xavier Sanchez <=