From e1c08afc943358e5afb49478f40722ebbf3cc07f Mon Sep 17 00:00:00 2001 From: Manuel Giraud 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-gnu-find-p): New variable to determine if "find" is a GNU find. (find-ls-option-default-ls): Use 'find-gnu-find-p' and adapt to a value that works with the default "find" on *BSD and Darwin/MacOS. Tested on OpenBSD and MacOS. --- lisp/find-dired.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/find-dired.el b/lisp/find-dired.el index 33376ee4ed9..264c6e3082f 100644 --- a/lisp/find-dired.el +++ b/lisp/find-dired.el @@ -50,8 +50,13 @@ find-exec-terminator :group 'find-dired :type 'string) +(defvar find-gnu-find-p + (eq 0 (ignore-errors + (process-file find-program nil nil nil null-device "--version"))) + "T if 'find-program' is a GNU find. NIL otherwise.") + (defvar find-ls-option-default-ls - (cons "-ls" (if (eq system-type 'berkeley-unix) "-gilsb" "-dilsb"))) + (cons "-ls" (if find-gnu-find-p "-dilsb" "-dgils"))) (defvar find-ls-option-default-exec (cons (format "-exec ls -ld {} %s" find-exec-terminator) "-ld")) -- 2.39.2