[Bug 2125504] [NEW] /usr/bin/sort: -k option does not behave as GNU's sort
Athos Ribeiro
2125504 at bugs.launchpad.net
Tue Sep 23 13:57:17 UTC 2025
Public bug reported:
As discussed in LP: #2125057, when GNU's sort takes the following input
```
17 new1 5434 online postgres /var/lib/postgresql/17/new1 /var/log/postgresql/postgresql-17-new1.log
17 new2 5440 online postgres /var/lib/postgresql/17/new2 /var/log/postgresql/postgresql-17-new2.log
17 old 5435 online postgres /var/lib/postgresql/17/old /var/log/postgresql/postgresql-17-old.log
```
and sorts it with `-k3`, it outputs:
```
17 new1 5434 online postgres /var/lib/postgresql/17/new1 /var/log/postgresql/postgresql-17-new1.log
17 old 5435 online postgres /var/lib/postgresql/17/old /var/log/postgresql/postgresql-17-old.log
17 new2 5440 online postgres /var/lib/postgresql/17/new2 /var/log/postgresql/postgresql-17-new2.log
```
while uutils' sort outputs:
```
17 old 5435 online postgres /var/lib/postgresql/17/old /var/log/postgresql/postgresql-17-old.log
17 new1 5434 online postgres /var/lib/postgresql/17/new1 /var/log/postgresql/postgresql-17-new1.log
17 new2 5440 online postgres /var/lib/postgresql/17/new2 /var/log/postgresql/postgresql-17-new2.log
```
Note that he line being sorted in the first position has an additional space before the third field (" 5435").
It seems that uutils' sort is including that second space in the string being sorted, while GNU's sort ignores it.
** Affects: rust-coreutils (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to rust-coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/2125504
Title:
/usr/bin/sort: -k option does not behave as GNU's sort
Status in rust-coreutils package in Ubuntu:
New
Bug description:
As discussed in LP: #2125057, when GNU's sort takes the following
input
```
17 new1 5434 online postgres /var/lib/postgresql/17/new1 /var/log/postgresql/postgresql-17-new1.log
17 new2 5440 online postgres /var/lib/postgresql/17/new2 /var/log/postgresql/postgresql-17-new2.log
17 old 5435 online postgres /var/lib/postgresql/17/old /var/log/postgresql/postgresql-17-old.log
```
and sorts it with `-k3`, it outputs:
```
17 new1 5434 online postgres /var/lib/postgresql/17/new1 /var/log/postgresql/postgresql-17-new1.log
17 old 5435 online postgres /var/lib/postgresql/17/old /var/log/postgresql/postgresql-17-old.log
17 new2 5440 online postgres /var/lib/postgresql/17/new2 /var/log/postgresql/postgresql-17-new2.log
```
while uutils' sort outputs:
```
17 old 5435 online postgres /var/lib/postgresql/17/old /var/log/postgresql/postgresql-17-old.log
17 new1 5434 online postgres /var/lib/postgresql/17/new1 /var/log/postgresql/postgresql-17-new1.log
17 new2 5440 online postgres /var/lib/postgresql/17/new2 /var/log/postgresql/postgresql-17-new2.log
```
Note that he line being sorted in the first position has an additional space before the third field (" 5435").
It seems that uutils' sort is including that second space in the string being sorted, while GNU's sort ignores it.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2125504/+subscriptions
More information about the foundations-bugs
mailing list