bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: . and .. are included where they were excluded before


From: Chet Ramey
Subject: Re: . and .. are included where they were excluded before
Date: Tue, 26 Jan 2021 12:08:27 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.1

On 1/25/21 4:36 PM, gregrwm wrote:

Bash Version: 5.0
Patch Level: 17
Release Status: release

Description:
         . and .. are excluded from @(?|.?) in
         bash 4.2.46(2)-release (CentOS 7.8), but are included in
         bash 4.4.19(1)-release (CentOS 8.2) and
         bash 5.0.17(1)-release (Ubuntu 20.04/focal).

         is this change in functionality a regression, a "fix", or a new
feature?
         is there any option to exclude them?

We're talking about behavior that changed around ten years ago, so there's
probably no going back.


         in all 3, .. is included in .?

Yes, basically every shell except mksh does this. The leading dot is
matched explicitly.


         so oddly in centos7 .. is included in .? but excluded from @(?|.?)

CentOS is using a version of bash that's over ten years old.


         and in the more recent versions it's a different inconsistency, .
is excluded from ? ?? but included in @(?|.?)

That's the real question: whether or not `.' should match @(?|.?), even
when dotglob is enabled (and yes, both patterns have to be in there). There
isn't really any other. Since it doesn't match ? when dotglob is enabled,
there's an obvious inconsistency there, and that's what I'll look at.


         but that's a bit askew from what actually interests me.  if i had
my druthers, there would be an option to set so . and .. would never match
any (sub)glob other than their literal selves (even with dotglob set).

As Kerin Millar said, you can use GLOBIGNORE for this.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]