Re: extglob patterns and dotfiles

2017-12-31 Thread Chet Ramey
On 12/29/17 6:55 PM, Eric Cook wrote:
> When using an pattern that begin with an period in pattern-list, bash will 
> include dotfiles in the results.
> This doesn't seem to be the case with the various korn shells that i have 
> seen. Since extglob is based on
> ksh's extension to globbing, this appears to be an bug.

It's an interesting question. .c certainly doesn't match any of the
subpatterns. I guess including a `.' as the leading character in the
subpatterns shouldn't allow filenames beginning with `.' to be returned
as not matching. I'll take a look.

Chet
-- 
``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/



Pull request: Fix typo from documentation

2017-12-31 Thread Jorge Maldonado Ventura
Description: I don't know if I should change PATCHLEVEL number, so
increment it if necessary. I didn't generate the PDF, HTML, etc. to make
the patch smaller. Please amend the commit if necessary. Below the
changes made.


The following changes since commit bc007799f0e1362100375bb95d952d28de4c62fb:

  Bash-4.4 patch 12 (2017-01-27 11:25:44 -0500)

are available in the git repository at:

  https://notabug.org/jorgesumle/bash

for you to fetch changes up to 814999af32bf9c4163a66ad31ba7759f8874:

  Fix typo from Bash Reference Manual (2017-12-31 19:46:15 +0100)


Jorge Maldonado Ventura (1):
  Fix typo from Bash Reference Manual

 doc/bashref.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/bashref.texi b/doc/bashref.texi
index c0f4a2f..572fa16 100644
--- a/doc/bashref.texi
+++ b/doc/bashref.texi
@@ -3587,7 +3587,7 @@ If @var{n} is not supplied, the return value is
the exit status of the
 last command executed in the function.
 If @code{return} is executed by a trap handler, the last command used to
 determine the status is the last command executed before the trap handler.
-if @code{return} is executed during a @code{DEBUG} trap, the last command
+If @code{return} is executed during a @code{DEBUG} trap, the last command
 used to determine the status is the last command executed by the trap
 handler before @code{return} was invoked.
 @code{return} may also be used to terminate execution of a script





Re: Pull request: Fix typo from documentation

2017-12-31 Thread Chet Ramey
On 12/31/17 2:13 PM, Jorge Maldonado Ventura wrote:
> Description: I don't know if I should change PATCHLEVEL number, so
> increment it if necessary. I didn't generate the PDF, HTML, etc. to make
> the patch smaller. Please amend the commit if necessary. Below the
> changes made.

Thanks for the report.

-- 
``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: extglob patterns and dotfiles

2017-12-31 Thread Eric Cook
On 12/31/2017 01:47 PM, Chet Ramey wrote:
> On 12/29/17 6:55 PM, Eric Cook wrote:
>> When using an pattern that begin with an period in pattern-list, bash will 
>> include dotfiles in the results.
>> This doesn't seem to be the case with the various korn shells that i have 
>> seen. Since extglob is based on
>> ksh's extension to globbing, this appears to be an bug.
> 
> It's an interesting question. .c certainly doesn't match any of the
> subpatterns. I guess including a `.' as the leading character in the
> subpatterns shouldn't allow filenames beginning with `.' to be returned
> as not matching. I'll take a look.
> 
> Chet
> 

I guess the behavior is a little more subtle than that, with ksh93.

ksh93 $ touch a .c
ksh93 $ echo @(|.)!(b|c)
. .. a

I personally would expect .c being omitted since @(.|) is an logical or
of . and empty string. but at the moment with bash .c is still matched.

mksh, openbsd ksh and pdksh avoid the ambiguity(?) by not allowing dotfiles
to be matched at all with [@*?+!]() which i think bash probably
should not follow, since it historically does match dotfiles.

So to make my request more specific, i don't think the extglob !() should
match dotfiles when one of the patterns in the list is preceded with an period.
to be more ksh93-like.