[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35939: version sort is incorrect with hyphen-minus

From: Vincent Lefevre
Subject: bug#35939: version sort is incorrect with hyphen-minus
Date: Tue, 28 May 2019 02:53:39 +0200
User-agent: Mutt/1.12+5 (cd30526c) vl-117499 (2019-05-26)

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
     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 <address@hidden> - 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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]