Re: Infinite loop in bash glob matching

2017-05-18 Thread Chet Ramey
On 5/18/17 2:29 AM, Zoltán Herczeg wrote: >> I read this as saying that it's a requirement on the application to ensure >> that character classes are correctly formed, and it's unspecified behavior >> if they're not. >> >> So you're right: people should not count on shells treating improperly- >> f

Re: Infinite loop in bash glob matching

2017-05-18 Thread Greg Wooledge
On Thu, May 18, 2017 at 08:29:13AM +0200, Zoltán Herczeg wrote: > I think throwing an error would be better than an undefined behaviour. Bash > throws error for solo parenthesis, a similar technique could be used here. That's not really an option, because an unmatched [ isn't a syntax error. It'

Re: Infinite loop in bash glob matching

2017-05-17 Thread Zoltán Herczeg
>I read this as saying that it's a requirement on the application to ensure >that character classes are correctly formed, and it's unspecified behavior >if they're not. > >So you're right: people should not count on shells treating improperly- >formed character classes as literal characters. Thank

Re: Infinite loop in bash glob matching

2017-05-17 Thread Chet Ramey
On 5/17/17 10:52 AM, Eduardo Bustamante wrote: > Then in "9.3.5 RE Bracket Expression" > (http://pubs.opengroup.org/onlinepubs/9699919799.2008edition/basedefs/V1_chap09.html#tag_09_03_05), > > The character sequences "[." , "[=" , and "[:" ( > followed by a , , or ) shall be special insi

Re: Infinite loop in bash glob matching

2017-05-17 Thread Eduardo Bustamante
On Tue, May 16, 2017 at 2:36 PM, Zoltán Herczeg wrote: [...] > bash version: GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu) > This command hangs in any directory on my machine (I don't have a directory > without a dot file): > > ls @(@()). Yeah, I can reproduce the problem with bash 4

Re: Infinite loop in bash glob matching

2017-05-16 Thread Zoltán Herczeg
Hi, bash version: GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu) This command hangs in any directory on my machine (I don't have a directory without a dot file): ls @(@()). >> The shell globbing library seems to be interpreting this pattern >> weirdly. I don't know the answer for thi

Re: Infinite loop in bash glob matching

2017-05-16 Thread Daniel Mills
The '[:' may be messing with it, 'a[[:alpha:]:abm[]' should work. It won't match 'amm' because the range only matches a single character, you'd need 'a+([[:alpha:]:abm[])' On Tue, May 16, 2017 at 10:49 AM, Eduardo Bustamante wrote: > On Tue, May 16, 2017 at 2:48 AM, Zoltán Herczeg > wrote: > >

Re: Infinite loop in bash glob matching

2017-05-16 Thread Eduardo Bustamante
On Tue, May 16, 2017 at 2:48 AM, Zoltán Herczeg wrote: > Hi, > > bash enter an infinite loop for this glob: > > ls @(@()). It works fine for me. What version of Bash are you using? And, what files are in the directory you're testing in? dualbus@debian:~/t$ ls a.1 a.2 a.3 a.4 b.1 b.2 b.3 b