Re: bin/tar incorrectly parse '[^...]' patterns in --exclude

From: Tim Kientzle <kientzle_at_freebsd.org>
Date: Tue, 5 Oct 2010 21:31:29 -0700
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)
> _at__at_ -35,7 +35,7 _at__at_
> 
> /*
>  * 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>
>  *
> _at__at_ -60,7 +60,7 _at__at_
> 	(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
Received on Wed Oct 06 2010 - 02:49:08 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:08 UTC