GNU bug report logs - #66253
sort manpage should be more explicit

Previous Next

Package: coreutils;

Reported by: Jorge Stolfi <stolfi <at> ic.unicamp.br>

Date: Thu, 28 Sep 2023 10:17:03 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jorge Stolfi <stolfi <at> ic.unicamp.br>
To: 66253 <at> debbugs.gnu.org
Subject: bug#66253: sort manpage should be more explicit
Date: Thu, 28 Sep 2023 07:11:50 -0300
The full documentation of sort explains that numeric sorting (as in  
"sort -n") accepts a leading "-" sign, decimal points, thousands  
separators, etc, but does not accept an explicit "+" sign. Values with  
explicit "+" are treated as numeric 0 and ties are broken by alpha sort.

However, the manpage only says that "-n" "compares according to string  
numerical value" -- and one would expect the numerical value of "+100"  
to be 100, not zero.

It took me an hour to figure out that my "sort -n" was failing because  
of this "feature".  Surely many users have wasted time too, or worse.  
So please either

1) explain precisely IN THE MANPAGE what is a valid number;

2) make numeric sort accept a leading "+", as users would expect;

3) make numeric sort abort with an error message if any field that is  
supposed to be sorted numerically is not a valid number.

I think the best solution for users would be to implement all three of  
these...

Thank you, and all the best

--jorge

-- 
Jorge Stolfi - Professor Titular/Full Professor
Instituto de Computação/Computer Science Dept
Universidade Estadual de Campinas/State University of Campinas
Campinas, SP - Brazil





This bug report was last modified 1 year and 235 days ago.

Previous Next


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