[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Version sort behavior
From: |
Bruno Haible |
Subject: |
Re: Version sort behavior |
Date: |
Sat, 04 Jun 2022 01:18:18 +0200 |
Artém S. Tashkinóv wrote:
> I'd like to know why the version sort behavior has changed drastically
> and how the following list is supposed to be version sorted:
>
> .mozilla.ram
> .wine
> .ICE-unix
> .X11-unix
> .XIM-unix
> .chrome-cache
> .font-unix
> .vbox-birdie-ipc
> .wine-1000
>
> The new version sort doesn't look like it's sorted at least to me.
>
> The pertinent details are discussed here
> https://midnight-commander.org/ticket/4374
I can reproduce the issue, with coreutils 9.1 vs. 9.0:
$ mkdir 4374
$ cd 4374
$ touch .ICE-unix .X11-unix .XIM-unix .chrome-cache .font-unix .mozilla.ram
.vbox-birdie-ipc .wine .wine-1000
$ LC_ALL=C ls-9.0 --group-directories-first --sort=version -a .|cat
.
..
.ICE-unix
.X11-unix
.XIM-unix
.chrome-cache
.font-unix
.mozilla.ram
.vbox-birdie-ipc
.wine
.wine-1000
bruno@omega:/tmp/4374$ LC_ALL=C ls-9.1 --group-directories-first --sort=version
-a .|cat
.
..
.mozilla.ram
.wine
.ICE-unix
.X11-unix
.XIM-unix
.chrome-cache
.font-unix
.vbox-birdie-ipc
.wine-1000
It seems like all file names without a '-' get sorted before all file names
with a '-', and that this is the primary sort criterion.
coreutils/src/ls.c uses filevercmp (not versionsort), and this behaviour seems
to contradict the specification in filevercmp.h.
Bruno