Re: !(.pattern) can match . and .. if dotglob is enabled

2021-06-19 Thread Chet Ramey

On 6/17/21 3:53 PM, Nora Platiel wrote:

On 2021-06-15 10:19 Chet Ramey wrote:

Or rather,
to never generate . or .. as a pathname component via globbing.


I don't think it's useful -- and it's certainly incompatible -- to make
an explicit pattern like `.?' ignore `..'.


I think it would be most useful. A better design.


It's far too late to relitigate that decision, which dates back to at
least the original Bourne shell and probably much earlier (I do not
have earlier versions available for testing right now).

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



Re: !(.pattern) can match . and .. if dotglob is enabled

2021-06-19 Thread Chet Ramey

On 6/17/21 3:41 PM, Nora Platiel wrote:

On 2021-06-15 09:43 Chet Ramey wrote:

I can see how this would be more intuitive. Let's try it. I'll put support
in the next devel branch push.


Thanks!


I'm leaning towards a general statement about how dotglob affects the set
of filenames that are tested against the extended patterns, rather than
calling out `!' specially.


What about this:
| The extended pattern matching operators cannot match the leading dot of
| filenames `.' and `..' (or any filename, if dotglob is unset) unless the
| _matching_ subpattern starts with a literal dot.


I decided on this:

When matching filenames, the \fBdotglob\fP shell option determines
the set of filenames that are tested:
when \fBdotglob\fP is enabled, the set of filenames includes all files
beginning with ``.'', but ``.'' and ``..'' must be matched by a
pattern or sub-pattern that begins with a dot;
when it is disabled, the set does not
include any filenames beginning with ``.'' unless the pattern
or sub-pattern begins with a ``.''.
As above, ``.'' only has a special meaning when matching filenames.

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



Re: !(.pattern) can match . and .. if dotglob is enabled

2021-06-19 Thread Nora Platiel
Hello,
I just tried your commit of Tue Jun 15. I tested all the relevant patterns that 
came to mind, and they all behave as agreed.
I'll let you know if I find something unexpected but I'm satisfied with this 
solution.
Thanks for your work.
NP