[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#240887: Package building problem.



On Thu, Apr 15, 2004 at 09:40:05PM +1000, Herbert Xu wrote:
> On Wed, Apr 14, 2004 at 01:59:01PM +0200, Frank K?ster wrote:
> > This is how dash calls it in _some_ subdirectories:
> > 
> > configuring in tetex
> > running /bin/sh ./configure  --prefix=/usr --enable-ipc --without-dialog\
> >   --without-texinfo --with-system-ncurses --with-x --with-system-zlib \
> >   --with-system-pnglib --with-system-tifflib --with-system-wwwlib \
> >   --with-system-t1lib --disable-multiplatform --enable-shared \
> >   --mandir=/usr/share/man --infodir=${prefix}/share/info \
> >   --cache-file=.././config.cache --srcdir=.
> > loading cache .././config.cache
> > 
> > That is, dash replaced the first occurence of ${prefix} by the variable
> > expansion. This shouldn't happen, because it is enclosed in single
> > quotes. 
> 
> This is caused by dash's use of fnmatch(3) which appears to break
> on patterns containing [\]...].
> 
> Here is a sample program to demonstrate it.
> 
> #include <stdio.h>
> #include <fnmatch.h>
> 
> int main(int argc, char **argv)
> {
> 	printf("%d\n", fnmatch("[\\]a]", "a", 0));
> 	return 0;
> }

fnmatch(3) references glob(7), which says:

   Character classes
       An expression `[...]' where the first character after the lead-
       ing `[' is not an `!' matches a single character, namely any of
       the characters enclosed by the brackets.  The  string  enclosed
       by  the  brackets cannot be empty; therefore `]' can be allowed
       between the brackets, provided that it is the first  character.
       (Thus,  `[][!]' matches the three characters `[', `]' and `!'.)

   ...

       One  can remove the special meaning of `?', `*' and `[' by pre-
       ceding them by a backslash, or, in case this is part of a shell
       command line, enclosing them in quotes.  Between brackets these
       characters stand for themselves.  Thus,  `[[?*\]'  matches  the
       four characters `[', `?', `*' and `\'.

Accordingly, I believe that the pattern in your example means
"backslash, followed by a, followed by closing square bracket", not what
you think it means.

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: