Subject: Re: bug#64791: 30.0.50; [PATCH] Fix dired mismatch on some filenames

From: Stefan Kangas <[email-masked]>
Date: Sun, 3 Sep 2023 04:34:38 -0700

Eli Zaretskii <[email-masked]> writes:

>> From: Manuel Giraud <[email-masked]>
>> Cc: [email-masked]
>> Date: Sat, 22 Jul 2023 16:46:27 +0200
>>
>> Eli Zaretskii <[email-masked]> writes:
>>
>> > I'm not sure there can be the end to such fixes.  The real fix is to
>> > use GNU 'ls' which has special support for Dired (or use ls-lisp.el).
>> > I guess you don't have GNU 'ls', since you are on OpenBSD?

Yup.  Perhaps we should consider checking for the existence of "gls" and
using that.  E.g., I use the following, here:

  (if (and (memq system-type '(berkeley-unix darwin))
           (executable-find "gls"))
      (setq insert-directory-program "gls"))

But I've only tested this on macOS so far, so I'm not sure how well this
would work on *BSD.  From memory, I think it should be fine.  Perhaps
Manuel can say what he thinks.

>> You're right I'm using OpenBSD's ls.  But I thought it was a reasonable
>> fix: it seems more obvious then looking for something that looked like a
>> file size.
>
> Maybe.  Let's hear what others think about this.

FWIW, I don't think I mind such portability fixes.  It wouldn't be a bad
thing if Dired played a bit more nicely on BSD machines.

The point that this could be a slippery slope is valid, but we can also
choose to reject further tweaks on a case-by-case basis.  The format of
ls is also inherently stable: many things depend on it.

On the other hand, the fix I propose above might be all that is needed
in many cases.