Subject: Re: bin/4020: Globbing error in /bin/sh
To: None <mouse@Rodents.Montreal.QC.CA>
From: Ian Dall <Ian.Dall@dsto.defence.gov.au>
List: netbsd-bugs
Date: 08/21/1997 10:08:30
der Mouse <mouse@Rodents.Montreal.QC.CA> writes:
>> arg='&foo'
>> case "$arg" in
>> *[\[\]\&]*)
> That expression matches
> * zero or more characters
> [\[\] same as [[] - an open bracket
> \& an &
> ] a close bracket
> * zero or more characters
> which does not match "&foo".
This code is from autoconfig and works in bash. That, of course, is
no guarantee it is correct!
> There may be a bug, but if so it's in quoting, not matching. ] is not
> considered to be a character that needs quoting, so attempts to quote
> it get stripped, and by the time it makes it down to the routine that
> matches [...] character classes in glob patterns, any record of it
> having been quoted has been destroyed. Read the "Shell Patterns"
> section in the sh manpage (at the top of page 19); ] is not a
> meta-character - or, to put it another way, a character class opened by
> [ extends up to the next ] *regardless of whether the ] is quoted*
> (with a special case to allow putting ] into a class by listing it
> first).
Sounds like the bug is in autoconf. Thanks for the analysis.
Ian