Subject: bug#62096: 30.0.50; find-dired, dired-goto-file and spaces

From: Manuel Giraud <[email-masked]>
Date: Sat, 11 Mar 2023 15:02:44 +0100

Hi,

So here is a patch that should fix *BSD and macOS.  For Windows, I don't
know if it is the right fix (so it does nothing on Windows, sorry Drew).

I choose "-dgils" because FreeBSD, NetBSD and macOS man pages state the
following about -ls switch for find(1):
The format is identical to that produced by "ls -dgils".

On OpenBSD, the find(1) man page says:
The format is identical to that produced by "ls -dils".

But the "-g" switch does not seems to do something different when the
"-l" is present.

For testing without recompiling Emacs, one could evaluate this:
--8<---------------cut here---------------start------------->8---
(setq find-ls-option-default-ls
  (cons "-ls" (if (or (eq system-type 'berkeley-unix)
                      (eq system-type 'darwin))
                  "-dgils"
                "-dilsb")))
--8<---------------cut here---------------end--------------->8---

Daniel: I'd like to hear what it does on macOS.

Drew: You could test on your system by "forcing"
'find-ls-option-default-ls' with the following:
--8<---------------cut here---------------start------------->8---
(setq find-ls-option-default-ls (cons "-ls" "-dils"))
--8<---------------cut here---------------end--------------->8---

This patch was produce on the main branch but FWIW I think it should
also go on emacs-29.

>From c9d343babc2ddc65066082669639964a7ddba017 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <[email-masked]>
Date: Fri, 10 Mar 2023 21:54:00 +0100
Subject: [PATCH] Fix 'find-ls-option-default-ls' for BSD/MacOS (bug#62096)

* lisp/find-dired.el (find-ls-option-default-ls): Adapt to a value
that works with OpenBSD and should also work with (Free|Net)BSD and
Darwin/MacOS.
---
 lisp/find-dired.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 33376ee4ed9..8f5aaa5f682 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -51,7 +51,10 @@ find-exec-terminator
   :type 'string)
 
 (defvar find-ls-option-default-ls
-  (cons "-ls" (if (eq system-type 'berkeley-unix) "-gilsb" "-dilsb")))
+  (cons "-ls" (if (or (eq system-type 'berkeley-unix)
+                      (eq system-type 'darwin))
+                  "-dgils"
+                "-dilsb")))
 
 (defvar find-ls-option-default-exec
   (cons (format "-exec ls -ld {} %s" find-exec-terminator) "-ld"))
-- 
2.39.1

-- 
Manuel Giraud