Bug 14496 - 'sort' is not consistent with its coreutils/toybox counterpart
Summary: 'sort' is not consistent with its coreutils/toybox counterpart
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All All
: P5 major
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-01 15:29 UTC by Kasper
Modified: 2022-01-04 22:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.