busybox sort wrong with -t/-k

Denys Vlasenko vda.linux at googlemail.com
Sat Sep 19 20:07:58 UTC 2015


Thank for reporting. fixed in git.

On Thu, Sep 17, 2015 at 9:04 PM, Christian Neukirchen
<chneukirchen at gmail.com> wrote:
> Hi,
>
> I noticed the following difference in output:
>
> GNU sort 8.24 and FreeBSD 10.2 sort:
>
> % printf '%s\n' a/a:a a:b | sort -t: -k1
> a/a:a
> a:b
> % printf '%s\n' a/a:a a:b | sort -t: -k1,1
> a:b
> a/a:a
>
> BusyBox v1.23.2 (2015-08-12 12:31:27 UTC) multi-call binary.
> Linux juno 4.1.7_1 #1 SMP PREEMPT Mon Sep 14 04:46:51 UTC 2015 x86_64 GNU/Linux
>
> % printf '%s\n' a/a:a a:b | busybox sort -t: -k1
> a/a:a
> a:b
> % printf '%s\n' a/a:a a:b | busybox sort -t: -k1,1
> a/a:a
> a:b
>
> -k1 means the rest of the line after field 1 is included, sorting
> a/a:a before a:b since '/' comes before ':'.
> -k1,1 means that only the first field should be regarded as key, thus
> a comes before a/a.
>
> Thanks,
> --
> Christian Neukirchen  <chneukirchen at gmail.com>  http://chneukirchen.org
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list