GNU bug report logs - #58476
buggy version sort

Previous Next

Package: coreutils;

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

Date: Wed, 12 Oct 2022 21:09:01 UTC

Severity: normal

To reply to this bug, email your comments to 58476 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#58476; Package coreutils. (Wed, 12 Oct 2022 21:09:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vincent Lefevre <vincent <at> vinc17.net>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 12 Oct 2022 21:09:01 GMT) Full text and rfc822 format available.

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: buggy version sort
Date: Wed, 12 Oct 2022 23:07:49 +0200
A regression in version sort (used as the natural sort for "ls")
has been introduced from coreutils 8.32 to 9.1:

With coreutils 8.32 (Debian 11):

$ printf "%s\n" a a0 a1 a.b a0.b a1.b | sort -V
a
a.b
a0
a0.b
a1
a1.b

With coreutils 9.1 (Debian/unstable):

$ printf "%s\n" a a0 a1 a.b a0.b a1.b | sort -V
a
a0
a0.b
a.b
a1
a1.b

This is now completely illogical.

-- 
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)




Information forwarded to bug-coreutils <at> gnu.org:
bug#58476; Package coreutils. (Thu, 13 Oct 2022 09:32:01 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Vincent Lefevre <vincent <at> vinc17.net>, bug-coreutils <at> gnu.org,
 Kamil Dudka <kdudka <at> redhat.com>
Subject: Re: bug#58476: buggy version sort
Date: Thu, 13 Oct 2022 10:31:38 +0100
On 12/10/2022 22:07, Vincent Lefevre wrote:
> A regression in version sort (used as the natural sort for "ls")
> has been introduced from coreutils 8.32 to 9.1:
> 
> With coreutils 8.32 (Debian 11):
> 
> $ printf "%s\n" a a0 a1 a.b a0.b a1.b | sort -V
> a
> a.b
> a0
> a0.b
> a1
> a1.b
> 
> With coreutils 9.1 (Debian/unstable):
> 
> $ printf "%s\n" a a0 a1 a.b a0.b a1.b | sort -V
> a
> a0
> a0.b
> a.b
> a1
> a1.b
> 
> This is now completely illogical.

This looks to be the same point as discussed in https://bugs.gnu.org/58153
where a trailing '0' is essentially ignored when sorting,
as per the debian version sorting spec.

This is surprising, and perhaps we should diverge from the spec
in this regard, but I'm not sure.

thanks,
Pádraig




Information forwarded to bug-coreutils <at> gnu.org:
bug#58476; Package coreutils. (Thu, 13 Oct 2022 10:10:02 GMT) Full text and rfc822 format available.

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

From: Vincent Lefevre <vincent <at> vinc17.net>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: Kamil Dudka <kdudka <at> redhat.com>, bug-coreutils <at> gnu.org
Subject: Re: bug#58476: buggy version sort
Date: Thu, 13 Oct 2022 12:09:21 +0200
On 2022-10-13 10:31:38 +0100, Pádraig Brady wrote:
> This looks to be the same point as discussed in https://bugs.gnu.org/58153
> where a trailing '0' is essentially ignored when sorting,
> as per the debian version sorting spec.
> 
> This is surprising, and perhaps we should diverge from the spec
> in this regard, but I'm not sure.

I doubt very much that having two revisions "upstream_version" and
"upstream_version-0" at the same time is allowed. Since they are
regarded as equivalent, this would confuse the system to decide
which one should be preferred as the latest version.

However, for "sort" or "ls", one may have "foo" and "foo-0" at
the same time, and they need to be sorted. For instance, 0 could
be regarded as an epsilon. So the sorting in my example would be
correct.

-- 
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 2 years and 24 days ago.

Previous Next


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