My concern is best described as follows.

~ $ echo -e 
"CVE-2018-13787\nCVE-2019-16649\nCVE-2019-16650\nCVE-2020-15046\nCVE-2018-13787"
 | sort -h
CVE-2018-13787
CVE-2018-13787
CVE-2019-16649
CVE-2019-16650
CVE-2020-15046

~ $ echo -e 
"CVE-2018-13787\nCVE-2019-16649\nCVE-2019-16650\nCVE-2020-15046\nCVE-2018-13787"
 | sort -h -u
CVE-2018-13787

The introduction of the unique operator (-u) returns a wrong answer when used 
with the human sorting operator (-h).

Note the problem does not occur when the human sorting operator is not used.

~ $ echo -e 
"CVE-2018-13787\nCVE-2019-16649\nCVE-2019-16650\nCVE-2020-15046\nCVE-2018-13787"
 | sort
CVE-2018-13787
CVE-2018-13787
CVE-2019-16649
CVE-2019-16650
CVE-2020-15046

~ $ echo -e 
"CVE-2018-13787\nCVE-2019-16649\nCVE-2019-16650\nCVE-2020-15046\nCVE-2018-13787"
 | sort -u
CVE-2018-13787
CVE-2019-16649
CVE-2019-16650
CVE-2020-15046

The example suggests the existence of a programming error between the output of 
-h and the input of -u.


-------- Original Message --------
On 2/16/25 07:23, Paul Eggert wrote:

>  I don't see a bug there, just an infelicity. -h means 'sort' should look for 
> a number, and your data lines don't start with numbers.
>  
>  Try 'sort --debug -h -u' to see more.
>



Reply via email to