If you have a file with numerical values like the one bellow : % cat testfile 12 1 3 19 1 6 2 1 1 7 1 2 1 2 1 16 2 4 % sort -k2n testfile 2 1 1 7 1 2 12 1 3 19 1 6 1 2 1 16 2 4 % sort -k2n -k1n testfile returns nothing but error 255 The same if we try any combination if the first key is numeric Investigations on the code shows that we fail in mt_sort() function.
A commit references this bug: Author: marius Date: Wed Dec 28 17:13:04 UTC 2016 New revision: 310712 URL: https://svnweb.freebsd.org/changeset/base/310712 Log: - Use correct offsets into the keys set array. As the elements of this zero-length array are dynamically sized at run-time based on the use of hints, compilers can't be expected to figure out these offsets on their own. [1] - Fix incorrect comparison in cmp_nans(). [2] PR: 204571 [1], 202301 [2] Submitted by: David Binderman [2] MFC after: 3 days Changes: head/usr.bin/sort/coll.c head/usr.bin/sort/coll.h head/usr.bin/sort/radixsort.c
A commit references this bug: Author: marius Date: Wed May 10 20:29:02 UTC 2017 New revision: 318152 URL: https://svnweb.freebsd.org/changeset/base/318152 Log: MFC: r310712 - Use correct offsets into the keys set array. As the elements of this zero-length array are dynamically sized at run-time based on the use of hints, compilers can't be expected to figure out these offsets on their own. [1] - Fix incorrect comparison in cmp_nans(). [2] PR: 204571 [1], 202301 [2] Submitted by: David Binderman [2] Changes: _U stable/10/ stable/10/usr.bin/sort/coll.c stable/10/usr.bin/sort/coll.h stable/10/usr.bin/sort/radixsort.c
A commit references this bug: Author: marius Date: Wed May 10 20:29:33 UTC 2017 New revision: 318153 URL: https://svnweb.freebsd.org/changeset/base/318153 Log: MFC: r310712 - Use correct offsets into the keys set array. As the elements of this zero-length array are dynamically sized at run-time based on the use of hints, compilers can't be expected to figure out these offsets on their own. [1] - Fix incorrect comparison in cmp_nans(). [2] PR: 204571 [1], 202301 [2] Submitted by: David Binderman [2] Changes: _U stable/11/ stable/11/usr.bin/sort/coll.c stable/11/usr.bin/sort/coll.h stable/11/usr.bin/sort/radixsort.c