From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: TAKAHASHI Yoshio Newsgroups: gmane.emacs.bugs Subject: bug#55787: 29.0.50; inconsistent sort order with ls-lisp-version-lessp Date: Sat, 04 Jun 2022 23:11:17 +0900 Message-ID: <87tu90jz7e.fsf@yfb02119.nifty.com> References: <87tu91fi43.fsf@yfb02119.nifty.com> <83h750c1q3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40371"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 55787@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 04 16:12:19 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nxUVm-000AGR-HR for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Jun 2022 16:12:19 +0200 Original-Received: from localhost ([::1]:57908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxUVl-0005XM-AK for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Jun 2022 10:12:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxUVX-0005XD-Hx for bug-gnu-emacs@gnu.org; Sat, 04 Jun 2022 10:12:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37309) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nxUVW-0002IU-4j for bug-gnu-emacs@gnu.org; Sat, 04 Jun 2022 10:12:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nxUVW-0000TU-07 for bug-gnu-emacs@gnu.org; Sat, 04 Jun 2022 10:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: TAKAHASHI Yoshio Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Jun 2022 14:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55787 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 55787-submit@debbugs.gnu.org id=B55787.16543518911781 (code B ref 55787); Sat, 04 Jun 2022 14:12:01 +0000 Original-Received: (at 55787) by debbugs.gnu.org; 4 Jun 2022 14:11:31 +0000 Original-Received: from localhost ([127.0.0.1]:59439 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxUV0-0000Se-Nf for submit@debbugs.gnu.org; Sat, 04 Jun 2022 10:11:30 -0400 Original-Received: from conuserg-12.nifty.com ([210.131.2.79]:35489) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nxUUx-0000SN-AJ for 55787@debbugs.gnu.org; Sat, 04 Jun 2022 10:11:29 -0400 Original-Received: from LAPTOP-89LTAUNV.yfb02119.nifty.com (M014011160065.v4.enabler.ne.jp [14.11.160.65]) (authenticated) by conuserg-12.nifty.com with ESMTP id 254EBH64029999; Sat, 4 Jun 2022 23:11:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com 254EBH64029999 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1654351878; bh=tg1UG2dx6iQCEyPIKyrz/GkIYUT8MwwK0zE5iK1l+yY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=PxExQKWaMXYUCQAp4SvDVd4hqmoZEsfMrp9YeHns/zUZwvx95pUPGw2vCX7FpdNGp Zs0h5eKl8tjBWBKppNbe+uYqz5NLREuJizfpdlIWWP258HIBEbChqBca/W1dHjU0Jg I4OsJ87H8FTMPpCkRTPcwEsa/2nBvYySId6YuhuT8L6DCoiRNl7geYk8y1kpatTB5N gwPOpWg6Y0Dc56McKjyICzWv/96y+2NXgI/SNaawC5YcXOpR4t+QxpxdN03w77oK/G ETrIyy43WyPwjw4ZKslLmF+Py3XiijFjc4a4+k3/A+8CjmbPCU7pi576dhHuqSJw00 pnOsjlGXNWBDw== X-Nifty-SrcIP: [14.11.160.65] In-Reply-To: <83h750c1q3.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 Jun 2022 10:44:04 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:233665 Archived-At: Eli-san, Thank you for your replay. >> I encounter an inconsistent sort result. The position of "01.0" and/or >> "01.2" seems wrong. >> >> >> $ cat /tmp/test.el >> (require 'ls-lisp) >> (print (sort (vector "01.0" "10" "010" "01.2") >> (lambda (x y) >> (ls-lisp-version-lessp x y)))) >> $ emacs -Q --batch -l /tmp/test.el >> >> ["01.0" "10" "010" "01.2"] > > Why do you think this is wrong? This function is not meant to compare > dotted versions with undotted ones, only dotted to dotted or undotted > to undotted. The strings are supposed to be file names, where a dot > begins an extension. > > See the node "More details about version sort" in the GNU Coreutils > manual for more info. I report this "inconsistency" because ls-lisp does not sort files as ls program does when `dired-listing-switches' has 'v', such as "-alGv". # "01.0", "10", ... is minimal reproducible pattern that I stlipped down # my real filenames pattern. I'm not aware that `ls-lisp-version-lessp' does not support dotted-undotted mixed cases. Doc string says it acts as `strverscmp', I expect the same result (order) in dired buffer. And in below example, the result seems to act like `strverscmp'. (print (sort (vector "01.0" "10" "01.2") ; no "010" in arg. (lambda (x y) (ls-lisp-version-lessp x y)))) ["01.0" "01.2" "10"] > If you want a general-purpose version-comparison function, use > version< instead. Umm, do I need to use `version<' in `ls-lisp-handle-switches' with extracting numerical part from filename argument? -- tkh