Someone on the Alpine Linux users mailing list observed that "sort -s" is not stable as intended. " The following two commands (with and without -s) give different result on alpine linux 3.6.2/amd64, with busybox v1.26.2 (2017-08-03 13:08:12 GMT): $ printf "a X 1\nA X 2\nA x 5\n" | sort -k1,1 A X 2 A x 5 a X 1 $ printf "a X 1\nA X 2\nA x 5\n" | sort -k1,1 -s A x 5 A X 2 a X 1 " Another user observed that sort.c uses qsort(), which is documented as not stable, and suggested adding the line number as an additional (internal) key to make it so. Here are the mailing list posts: https://lists.alpinelinux.org/alpine-user/0178.html https://lists.alpinelinux.org/alpine-user/0180.html
commit 7d285c78a35b1e745f7c6f27e31d73677ad2943a Author: Denys Vlasenko <vda.linux@googlemail.com> Date: Wed Feb 21 20:08:54 2018 +0100 sort: fix -s. Closes 10671