[RFC] handling files with weird names in .bzrignore

Eric Siegerman lists08-bzr at davor.org
Sat May 29 17:04:16 BST 2010


On Sat, 2010-05-29 at 08:11 -0500, John Arbash Meinel wrote:
> Parth Malwankar wrote:
> > [filenames like "[" in .bzrignore crash bzr]
> > https://bugs.launchpad.net/bzr/+bug/433437
> > 
> > There are at least two ways we could fix this:
> > 
> > (1) Catch the exception and issue an error message [...]
> > 
> > (2)  we could allow
> > -F/--fixed-strings style patterns that would be prefixed with
> > say "FS:" in .bzrignore [...]
> 
> What about
> 
> (3) Be loose in our handling of globs such that [ with an unmatched ]
is
> just treated as '['.
> 
> (4) When turning patterns into regexes, anything that is illegal just
> gets thrown out with a warning saying that it isn't a legal pattern.


#2: Good idea!

#3 vs. #4: #3 is rather uncomfortably DWIMmish for my taste.
DWIM is arguably OK for transient patterns like the regexps one
types in a text editor, but for long-lived ones like those in a
.XXXignore file, it's safer to reject malformed patterns outright
(i.e. #4) and let the user make their meaning clear (for which #2
would be most helpful, in the case where the intent really is the
file with literal name "[").

#1: Not strictly necessary as long as 2, 3, and/or 4 successfully
prevent bad regexps from being handed to the pattern matcher in
the first place.  But if, as you say, it's easy to implement, why
not do it as well, as insurance?  Extra error checking couldn't
hurt, right?

  - Eric




More information about the bazaar mailing list