unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: TAKAHASHI Yoshio <yfb02119@nifty.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 55787@debbugs.gnu.org
Subject: bug#55787: 29.0.50; inconsistent sort order with ls-lisp-version-lessp
Date: Sun, 05 Jun 2022 11:37:11 +0900	[thread overview]
Message-ID: <877d5v96p4.fsf@yfb02119.nifty.com> (raw)
In-Reply-To: <837d5wbhvn.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 Jun 2022 17:52:44 +0300")

Eli-san,

With further tests, this ls-lisp behavior occurs only on my Mingw64
Windows Emacs environment.  I can not reproduce it on my WSL2 Ubuntu
environemnt.

> What do you see with 'ls' and what do you see with ls-lisp?  Also, in
> which locale are you trying this with 'ls'?

I include my trial to hope it can be reproduced on your environment.  In
this scenario, I use alittle more real filenames instead of just number.

================================================================

On my Windows machine, output from "M-! (shell-command) env"

OS=Windows_NT
LANG=ja_JP.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_TIME=C


================================================================

tkh$ cat ../createfiles.sh
touch "34 アルバム-300dpi.jpg"
touch "34 アルバム-300dpi.png"
touch "054_交換機.jpg"
touch "054_交換機.png"
touch "91 部分カット.jpg"
touch "91 部分カット.png"
touch "0717-パソコン.jpg"
touch "0717-パソコン.png"
touch "1935 社屋.jpg"
touch "1935 社屋.png"
touch "FFFF_縁カット.jpg"
touch "FFFF_縁カット.png"
touch "hhhh.jpg"
touch "hhhh.png"
tkh$ sh ../createfiles.sh
tkh$ ls -l
total 0
-rw-r--r-- 1 tkh 0 Jun  5 10:45 054_交換機.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 054_交換機.png
-rw-r--r-- 1 tkh 0 Jun  5 10:45 0717-パソコン.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 0717-パソコン.png
-rw-r--r-- 1 tkh 0 Jun  5 10:45 1935 社屋.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 1935 社屋.png
-rw-r--r-- 1 tkh 0 Jun  5 10:45 34 アルバム-300dpi.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 34 アルバム-300dpi.png
-rw-r--r-- 1 tkh 0 Jun  5 10:45 91 部分カット.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 91 部分カット.png
-rw-r--r-- 1 tkh 0 Jun  5 10:45 FFFF_縁カット.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 FFFF_縁カット.png
-rw-r--r-- 1 tkh 0 Jun  5 10:45 hhhh.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 hhhh.png
tkh$ ls -lv
total 0
-rw-r--r-- 1 tkh 0 Jun  5 10:45 34 アルバム-300dpi.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 34 アルバム-300dpi.png
-rw-r--r-- 1 tkh 0 Jun  5 10:45 054_交換機.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 054_交換機.png
-rw-r--r-- 1 tkh 0 Jun  5 10:45 91 部分カット.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 91 部分カット.png
-rw-r--r-- 1 tkh 0 Jun  5 10:45 0717-パソコン.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 0717-パソコン.png
-rw-r--r-- 1 tkh 0 Jun  5 10:45 1935 社屋.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 1935 社屋.png
-rw-r--r-- 1 tkh 0 Jun  5 10:45 FFFF_縁カット.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 FFFF_縁カット.png
-rw-r--r-- 1 tkh 0 Jun  5 10:45 hhhh.jpg
-rw-r--r-- 1 tkh 0 Jun  5 10:45 hhhh.png
tkh$


================================================================

On my Windows machine, "054_交換機.{jpg,png}" are wrongly listed in
dired buffer.

  drwxrwxrwx  1 0 Jun  5 10:45 .
  drwxrwxrwx  1 0 Jun  5 10:45 ..
  -rw-rw-rw-  1 0 Jun  5 10:45 34 アルバム-300dpi.jpg
  -rw-rw-rw-  1 0 Jun  5 10:45 34 アルバム-300dpi.png
  -rw-rw-rw-  1 0 Jun  5 10:45 054_交換機.png
  -rw-rw-rw-  1 0 Jun  5 10:45 91 部分カット.jpg
  -rw-rw-rw-  1 0 Jun  5 10:45 91 部分カット.png
  -rw-rw-rw-  1 0 Jun  5 10:45 0717-パソコン.jpg
  -rw-rw-rw-  1 0 Jun  5 10:45 0717-パソコン.png
  -rw-rw-rw-  1 0 Jun  5 10:45 054_交換機.jpg
  -rw-rw-rw-  1 0 Jun  5 10:45 1935 社屋.jpg
  -rw-rw-rw-  1 0 Jun  5 10:45 1935 社屋.png
  -rw-rw-rw-  1 0 Jun  5 10:45 FFFF_縁カット.jpg
  -rw-rw-rw-  1 0 Jun  5 10:45 FFFF_縁カット.png
  -rw-rw-rw-  1 0 Jun  5 10:45 hhhh.jpg
  -rw-rw-rw-  1 0 Jun  5 10:45 hhhh.png

================================================================

When I drilled down to understand this listing, I encountered sort order
inconsistency, from my point of view, reported in my original mail.


>> # "01.0", "10", ... is minimal reproducible pattern that I stlipped down
>> # my real filenames pattern.
>
> I'd prefer to see the real file names instead, since that's what
> ls-lisp-version-lessp was written to handle.

I did too simplification in my original mail.  It was not good for
report, sorry.


> The exact spec of strverscmp is not known, AFAIK, and the
> implementation is a state machine, which is somewhat hard to
> reverse-engineer.  I'm only aware of the documentation in the glibc
> manual; did you read it?

I saw strverscmp man page, then source.  And no attempt to understand
the state machine implemantation.


> Comparing with 'ls' is also somewhat problematic, because in UTF-8
> locales its collation rules ignore some punctuation characters --
> again, because that's how glibc implements that.  Emacs on MS-Windows
> can emulate this behavior if you set w32-collate-ignore-punctuation to
> a non-nil value.

I think `w32-collate-ignore-punctuation' seems not to affect my test
case.  In my trial, the dired buffer listing is same with t / nil of
`w32-collate-ignore-punctuation'.

-- 
tkh





  reply	other threads:[~2022-06-05  2:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03 23:21 bug#55787: 29.0.50; inconsistent sort order with ls-lisp-version-lessp TAKAHASHI Yoshio
2022-06-04  7:44 ` Eli Zaretskii
2022-06-04 14:11   ` TAKAHASHI Yoshio
2022-06-04 14:52     ` Eli Zaretskii
2022-06-05  2:37       ` TAKAHASHI Yoshio [this message]
2022-06-05  7:01         ` Eli Zaretskii
2022-06-05  9:38           ` TAKAHASHI Yoshio
2022-06-05  9:48             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877d5v96p4.fsf@yfb02119.nifty.com \
    --to=yfb02119@nifty.com \
    --cc=55787@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).