Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: 4.1.4: POSIX ranges



On Jul 8,  3:36pm, Peter Stephenson wrote:
} Subject: PATCH: 4.1.4: POSIX ranges
                  ^
		  3

} By the way, I haven't touched this, but what's happened to
} nobadpattern?
} 
} % setopt nobadpattern
} % [[ [ = [ ]]
} zsh: bad pattern: [
} 
} Is it really not supposed to work inside tests?

That complains in 3.0.5, too, but does not in 3.0.0 (which doesn't care
whether nobadpattern is set -- it never warns inside tests).

There are 13 places in zsh that print "bad pattern".  9 of them, all in
builtin.c, print a space between the word "pattern" and the following ":"
(consistent, aren't we), so they aren't involved above.  3 of the others
are in glob.c, the last is in options.c (in 3.0.5, it's in builtin.c).

Of those 13 places, only one is preceded by "if (unset(BADPATTERN))".
That one is in glob.c and follows a call to parsepat(); the other 12 all
follow calls to parsereg().  The 10 cases NOT in glob.c are implementing
the "-m" flag to various commands such as "setopt" (which happens to be
the one that doesn't print " :").

There are 7 other uses of parsereg() that don't print a warning, but no
other use of parsepat().

However, I can't figure out why 3.0.0 doesn't produce a "bad pattern"
on [[ [ = [ ]].  It's calling matchpat(), just as does 3.0.5 and later,
and matchpat() is one of the places in glob.c that prints the warning
(this is true as far back as 3.0.0 if not farther).

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author