Date: Tue, 5 Oct 2010 21:31:29 -0700 From: Tim Kientzle <kientzle@freebsd.org> To: Mykola Dzham <i@levsha.me> Cc: freebsd-current@freebsd.org Subject: Re: bin/tar incorrectly parse '[^...]' patterns in --exclude Message-ID: <18B9EF7D-BFBD-41D7-9BC8-46B52DF9D83C@freebsd.org> In-Reply-To: <20101005082723.GA2540@laptop.levsha.me> References: <20101005082723.GA2540@laptop.levsha.me>
next in thread | previous in thread | raw e-mail | index | archive | help
On Oct 5, 2010, at 1:27 AM, Mykola Dzham wrote:
> Hi!
> bsd tar parse only '[!...]' as negate pattern, but gnu tar and bsd tar
> on 8-STABLE parse '[^...]' too:
>
> Fix:
>
> Index: usr.bin/tar/pathmatch.c
> ===================================================================
> --- usr.bin/tar/pathmatch.c (revision 212602)
> +++ usr.bin/tar/pathmatch.c (working copy)
> @@ -35,7 +35,7 @@
>
> /*
> * Check whether a character 'c' is matched by a list specification [...]:
> - * * Leading '!' negates the class.
> + * * Leading '!' or '^' negates the class.
> * * <char>-<char> is a range of characters
> * * \<char> removes any special meaning for <char>
> *
> @@ -60,7 +60,7 @@
> (void)flags; /* UNUSED */
>
> /* If this is a negated class, return success for nomatch. */
> - if (*p == '!' && p < end) {
> + if ((*p == '!' || *p == '^') && p < end) {
> match = 0;
> nomatch = 1;
> ++p;
Thanks!
Committed at r213469.
Tim
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18B9EF7D-BFBD-41D7-9BC8-46B52DF9D83C>
