Subject: Re: bug#60819: 28.2; `ls-lisp.el' regression introduced in Emacs 26

From: Visuwesh <[email-masked]>
Date: Sun, 15 Jan 2023 23:15:54 +0530

[ஞாயிறு ஜனவரி 15, 2023] Drew Adams wrote:

>> > In general, the character / in a glob pattern cannot be matched by a
>> > wildcard.  E.g., Wikipedia says "Normally, the path separator character
>> > (/ on Linux/Unix, MacOS, etc. or \ on Windows) will never be matched."
>> > and Linux man page glob(7) says "A '/' in a pathname cannot be matched
>> > by a '?' or '*' wildcard, or by a range like "[.-0]"."
>> 
>> This is incorrect.  A wildcard like "*b*/" should expand to the list
>> of directories whose names match "*b*", whereas "*b*" should expand to
>> the list of files _and_ directories with matching names.  This is how
>> Dired behaves on Posix platforms (where such an expansion is done by
>> the 'ls' program), and we want a similar behavior with ls-lisp.
>
> Excellent.  That's in fact what I was naively expecting
> or hoping for.
>
> But googling for info about what such a glob pattern
> should match, I couldn't find anything that supported
> such an interpretation.  Could you maybe point me to a
> source that covers this - so I can read more and point
> others to it?  If you don't have the time to find that
> then don't worry about it.  Thx.

>From OpenBSD's glob(7) manpage [1],

    Note that when matching a pathname, the path separator ‘/’, is not
    matched by a ‘?’, or ‘*’, character or by a “[..]” sequence. Thus,
    /usr/*/*/X11 would match /usr/X11R6/lib/X11 and
    /usr/X11R6/include/X11 while /usr/*/X11 would not match
    either. Likewise, /usr/*/bin would match /usr/local/bin but not
    /usr/bin.

1. http://man.openbsd.org/glob.7