Bug 14496

Summary: 'sort' is not consistent with its coreutils/toybox counterpart
Product: Busybox Reporter: Kasper <kasperkantz>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: major CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Host: Target:
Build:

Description Kasper 2022-01-01 15:29:43 UTC
input:
```
$ cat << EOF | sort -k2rn -s
a 1
b 2
c 1
d 2
EOF
```

result with coreutils and toybox:
```
b 2
d 2
a 1
c 1
```

result with busybox:

```
d 2
b 2
c 1
a 1
```

whereas it should return the lines a, b, c, d according to the documented behavior of the 'stable' (`-s`) parameter, but instead returns d, b, c, a. It should reverse the order of the second column only and keep the first in the same order provided via stdin according to the `-r` flag as the implementation from GNU coreutils does.
Comment 1 Denys Vlasenko 2022-01-04 22:54:28 UTC
Thank you for the report. Fixed in git.