GNU bug report logs - #35939
version sort is incorrect with hyphen-minus

Previous Next

Package: coreutils;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Tue, 28 May 2019 00:55:01 UTC

Severity: normal

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vincent Lefevre <vincent <at> vinc17.net>
To: bug-coreutils <at> gnu.org
Subject: version sort is incorrect with hyphen-minus
Date: Tue, 28 May 2019 02:53:39 +0200
With GNU coreutils 8.30 under Debian/unstable, I get:

$ LC_ALL=C ls
ab-cd  abb  abe
$ LC_ALL=C ls -v
abb  abe  ab-cd

The hyphen-minus character should still be regarded as being less
than the letters (there are no digits, so both are expected to be
equivalent). The GNU coreutils manual says:

10.1.3 Sorting the output
-------------------------
[...]
‘-v’
‘--sort=version’
     Sort by version name and number, lowest first.  It behaves like a
     default sort, except that each sequence of decimal digits is
     treated numerically as an index/version number.  (*Note Details
     about version sort::.)

(which is exactly what I expect).

The "sort -V" command has the same issue.

Note: If I add two more files and compare with zsh:

zira% export LC_ALL=C
zira% ls
ab-cd  ab10  ab2  abb  abe
zira% ls -v
ab2  ab10  abb  abe  ab-cd
zira% echo *
ab-cd ab10 ab2 abb abe
zira% echo *(n)
ab-cd ab2 ab10 abb abe

one can see that zsh is correct, but Coreutils has an issue with the
hyphen-minus character.

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




This bug report was last modified 5 years and 351 days ago.

Previous Next


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