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

Tim Kientzle kientzle at freebsd.org
Wed Oct 6 04:49:08 UTC 2010


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



More information about the freebsd-current mailing list