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

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

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

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

2021-06-17 Thread Nora Platiel
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. Of

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

2021-06-17 Thread Nora Platiel
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,

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

2021-06-15 Thread Chet Ramey
On 6/6/21 6:31 AM, Ilkka Virta wrote: Can you write a set of rules that encapsulates what you would like to see? Or can the group? I think it's a bit weird that !(.foo) can match . and .. when * doesn't. The other means roughly "anything here", and the other means "anything but .foo

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

2021-06-15 Thread Chet Ramey
On 6/5/21 8:42 PM, Nora Platiel wrote: The "matched explicitly" refers to the previous sentence, which talks about the `.' at the start of a filename or path component needing to be matched explicitly by a pattern beginning with a `.' or containing a `.' at the right spot (after a `/'). I can

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

2021-06-06 Thread Nora Platiel
Hello, > Personally, I'd just want an option to always make . and .. hidden from > globs. [...] If such option existed, I would certainly use it. As I already said, I can't imagine why anyone would ever want a pattern to match `.' or `..' (unless the entire path component is literal). But even

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

2021-06-06 Thread Nora Platiel
In my previous message, I wrote: > Yes, it all depends on the "universal set" from which the matches of the inner > `pattern-list' are subtracted. > But in the current implementation, the inner matches are subtracted from: > - all files, if dotglob is set > - all except dot files, if dotglob is

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

2021-06-06 Thread Ilkka Virta
On Sun, Jun 6, 2021 at 1:31 PM Ilkka Virta wrote: > Personally, I'd just want an option to always make . and .. hidden from > globs. Or rather, > to never generate . or .. as a pathname component via globbing. But > without affecting > other behaviour, like dotglob, and without precluding the

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

2021-06-06 Thread Ilkka Virta
> Can you write a set of rules that encapsulates what you would like to see? > Or can the group? > I think it's a bit weird that !(.foo) can match . and .. when * doesn't. The other means roughly "anything here", and the other means "anything but .foo here", so having the latter match things the

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

2021-06-05 Thread Nora Platiel
Thanks again for the info. Now I understand why `.' and `..' are handled separately, and I can imagine the complexity. > The "matched explicitly" refers to the previous sentence, which talks about > the `.' at the start of a filename or path component needing to be matched > explicitly by a

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

2021-06-02 Thread Chet Ramey
On 5/31/21 11:23 AM, Nora Platiel wrote: How would you improve the wording? What do you think is most important to cover? Here is the full paragraph for reference: When a pattern is used for filename expansion, the character `.' at the start of a filename or immediately following a slash

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

2021-05-31 Thread Nora Platiel
Thank you for your effort in understanding my problem. > The actual change, captured in the `devel' branch that tracks bash > development, happened sometime in 2011. I see. > How would you improve the wording? What do you think is most important to > cover? Here is the full paragraph for

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

2021-05-27 Thread Chet Ramey
On 5/26/21 7:36 PM, Nora Platiel wrote: Hello, This is behavior that changed more than ten years ago. I thought it changed in this commit: https://git.savannah.gnu.org/cgit/bash.git/commit/?id=ac50fbac377e32b98d2de396f016ea81e8ee9961 2014-02-26 -> 7.2 years ago That's the commit to the

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

2021-05-26 Thread Nora Platiel
Hello, > This is behavior that changed more than ten years ago. I thought it changed in this commit: https://git.savannah.gnu.org/cgit/bash.git/commit/?id=ac50fbac377e32b98d2de396f016ea81e8ee9961 2014-02-26 -> 7.2 years ago But yes, I know it's old stuff and I was not implying a regression, just

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

2021-05-26 Thread Chet Ramey
On 5/25/21 8:58 PM, Nora Platiel wrote: Bash Version: 5.1 Patch Level: 8 Release Status: release Hello, Repeat-By: $ shopt -s dotglob extglob $ echo !(.foo) . .. .other files The doc says: "The filenames '.' and '..' must always be matched explicitly, even if dotglob is set." When dotglob

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

2021-05-25 Thread Nora Platiel
Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security uname output: Linux columbus 4.4.246-gentoo #2 SMP Thu Dec 31 17:31:16 -00 2020 i686 AMD Athlon(tm) XP 2800+ AuthenticAMD