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- >> formed character classes as literal characters. > > Thank you for the explanation. > > 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 a good example, since a parenthesis is a shell metacharacter, and an unquoted paren in a place where it's not syntactially valid is a syntax error. The choice here is between not matching because the pattern is invalid (the most common shell behavior) and treating the stray `[:' as characters to be matched because they don't form a valid pattern (the glibc behavior that Eduardo noted.) -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/