On 3/6/26 12:14 PM, Isaac Z. Schlueter wrote:

Bash Version: 5.3
Patch Level: 9
Release Status: release

Description:
   A negative extglob can match the empty string. Also, extglobs that appear
at the start of a pattern can match a dotfile, if they match a dot
explicitly.

   However, a negative extglob (or other extglob matching an empty string)
that comes ahead of a dot in a pattern will *not* allow that pattern to
match a dotfile. This seems inconsistent with the "Pathname expansion"
section, which states only that a '.' at the start (or immediatly following
a slash) must be "matched explicitly" unless dotglob is set. That is, it
seems that it *is* being "matched explicitly", but the path is not being
expanded as expected.

Thanks for the report. The issue is the null pattern in the extglob. The
bash glob code uses a function to determine whether a name should be
skipped instead of run through the matching engine, and that function
didn't allow the null pattern to match a filename beginning with a `.'.

It should allow the name and let the rest of the matcher determine whether
or not to match it. If there are other patterns in the list that begin
with a `.', those are sufficient whether or not there is an empty pattern
in the list, but the empty pattern itself shouldn't disqualify the pattern
list.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to