bug-coreutils@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Jorge Stolfi <stolfi@ic.unicamp.br>
To: 66253@debbugs.gnu.org
Subject: bug#66253: sort manpage should be more explicit
Date: Thu, 28 Sep 2023 07:11:50 -0300	[thread overview]
Message-ID: <20230928071150.Horde.3giKME-rgKIUNdigQjnchyV@webmail2.ic.unicamp.br> (raw)

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





             reply	other threads:[~2023-09-28 10:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 10:11 Jorge Stolfi [this message]
2023-09-28 11:22 ` bug#66253: sort manpage should be more explicit Pádraig Brady
2023-09-29  1:11   ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-coreutils

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230928071150.Horde.3giKME-rgKIUNdigQjnchyV@webmail2.ic.unicamp.br \
    --to=stolfi@ic.unicamp.br \
    --cc=66253@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).