[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] possible extraction issue : file named '['
From: |
Paul Eggert |
Subject: |
Re: [Bug-tar] possible extraction issue : file named '[' |
Date: |
Sun, 21 May 2006 01:32:21 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Sergey Poznyakoff <address@hidden> writes:
> Yes, you are right: it is not documented. As far as I can tell, you
> introduced this behaviour 9 years ago [1].
That revision has my name on it in CVS, but that's merely because I
was the guy who checked tar 1.12's source into CVS. I don't know who
actually introduced the behavior; it predates my stewardship. A good
chunk of the history of tar between 1994 and 1997 went missing before
I took over.
> 1. Change the default behavior to strict matching and expand --wildcards
> as you propose.
> 2. Declare a transition period during which tar will display a warning
> when it encounters a first file name containing special characters.
> Something like 'Pattern matching characters used in file names. Please,
> use --wildcards to enable pattern matching, or --no-wildcards to
> suppress this warning.'
> 3. After expiration of the transition period (I guess 1-2 releases will
> be quite enough), remove this warning.
That sounds good.
A couple of points. First, (2) can be done a bit more accurately by
checking whether strict matching disagrees with globbing as to whether
a file name is selected. A diagnostic needs to be generated only when
there is disagreement. For example, if the pattern is '?' and the
file name is '?', no diagnostic is needed, as there's a match under
either interpretation.
Second, there is still a bug in the current implementation. The
pattern '[' should match the file name '[', even if --wildcards is
enabled. This is for compatibility with traditional Unix, e.g.:
$ find . -name '[' -print
./[
I suppose this is a bug in fnmatch, which we can separate from the
main concern. I'll look into it (though not right away, I'm afraid).