GNU bug report logs - #76290
"sort -u" vs "sort -h -u": possible bug

Previous Next

Package: coreutils;

Reported by: Rupert Gallagher <ruga <at> protonmail.com>

Date: Fri, 14 Feb 2025 17:01:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #34 received at 76290-done <at> debbugs.gnu.org (full text, mbox):

From: Rupert Gallagher <ruga <at> protonmail.com>
To: "eggert <at> cs.ucla.edu" <eggert <at> cs.ucla.edu>
Cc: "76290-done <at> debbugs.gnu.org" <76290-done <at> debbugs.gnu.org>
Subject: Re: bug#76290: "sort -u" vs "sort -h -u": possible bug
Date: Tue, 18 Feb 2025 18:45:57 +0000
Dictionary sort corresponds to the intended behaviour.

> echo -e "abc\n123\n456\nCVE-2011-234\nAbc\ndef\nCVE-2024-123" | sort --debug -dfu

123
___
456
___
abc
___
CVE-2011-234
____________
CVE-2024-123
____________
def
___


By comparison, human (-h) and numeric (-n) sort cause data loss:

> echo -e "abc\n123\n456\nCVE-2011-234\nAbc\ndef\nCVE-2024-123" | sort --debug -hu
sort: note numbers use ‘.’ as a decimal point in this locale
abc
^ no match for key
123
___
456
___

If I were the author of gnu sort, I would delete the -h and -n options.




This bug report was last modified 92 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.