GNU bug report logs -
#65342
In Ubuntu 22.04 (unlike 20.04), sorting doesn't work properly
Previous Next
Reported by: Pl B <platon.new10 <at> gmail.com>
Date: Wed, 16 Aug 2023 17:33:02 UTC
Severity: normal
Tags: notabug
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 65342 in the body.
You can then email your comments to 65342 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#65342
; Package
coreutils
.
(Wed, 16 Aug 2023 17:33:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Pl B <platon.new10 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Wed, 16 Aug 2023 17:33:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Source file:
rs1009150173,100202244031
rs1009150172,13853975996
rs1009150170,54321425962
rs1009150171,11378896079
rs1009150,171582090052
Ubuntu 20.04.5:
sort -t ',' /path/to/rs_srt_exp.txt
rs1009150,171582090052
rs1009150170,54321425962
rs1009150171,11378896079
rs1009150172,13853975996
rs1009150173,100202244031
(correct order)
elementary OS 7 (Ubuntu 22.04.3):
sort -t ',' /path/to/rs_srt_exp.txt
rs1009150170,54321425962
rs1009150171,11378896079
rs1009150,171582090052
rs1009150172,13853975996
rs1009150173,100202244031
(wrong order)
Python 3.10.12:
with open('/path/to/rs_srt_exp.txt') as src_file_opened:
for elem in sorted(map(lambda line: line.rstrip().split(','),
src_file_opened)):
print(elem)
['rs1009150', '171582090052']
['rs1009150170', '54321425962']
['rs1009150171', '11378896079']
['rs1009150172', '13853975996']
['rs1009150173', '100202244031']
(correct order)
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#65342
; Package
coreutils
.
(Wed, 16 Aug 2023 18:09:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 65342 <at> debbugs.gnu.org (full text, mbox):
tag 65342 notabug
close 65342
stop
more info below...
On 16/08/2023 16:55, Pl B wrote:
> Source file:
> rs1009150173,100202244031
> rs1009150172,13853975996
> rs1009150170,54321425962
> rs1009150171,11378896079
> rs1009150,171582090052
>
> Ubuntu 20.04.5:
> sort -t ',' /path/to/rs_srt_exp.txt
> rs1009150,171582090052
> rs1009150170,54321425962
> rs1009150171,11378896079
> rs1009150172,13853975996
> rs1009150173,100202244031
> (correct order)
>
> elementary OS 7 (Ubuntu 22.04.3):
> sort -t ',' /path/to/rs_srt_exp.txt
> rs1009150170,54321425962
> rs1009150171,11378896079
> rs1009150,171582090052
> rs1009150172,13853975996
> rs1009150173,100202244031
> (wrong order)
>
> Python 3.10.12:
> with open('/path/to/rs_srt_exp.txt') as src_file_opened:
> for elem in sorted(map(lambda line: line.rstrip().split(','),
> src_file_opened)):
> print(elem)
> ['rs1009150', '171582090052']
> ['rs1009150170', '54321425962']
> ['rs1009150171', '11378896079']
> ['rs1009150172', '13853975996']
> ['rs1009150173', '100202244031']
> (correct order)
-t is ineffective without -k
I suspect the differing orders were due to locale differences.
To get expected ordering you probably want something like:
sort -t ',' -k1.3,1n -k2,2n
Note the --debug option is useful for identifying how sort is operating.
cheers,
Pádraig
Added tag(s) notabug.
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Wed, 16 Aug 2023 18:09:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
65342 <at> debbugs.gnu.org and Pl B <platon.new10 <at> gmail.com>
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Wed, 16 Aug 2023 18:09:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 14 Sep 2023 11:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 281 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.