From owner-freebsd-current@FreeBSD.ORG Tue Oct 5 08:56:03 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 713201065670; Tue, 5 Oct 2010 08:56:03 +0000 (UTC) (envelope-from i@levsha.me) Received: from expo.ukrweb.net (mail.univua.net [91.202.128.78]) by mx1.freebsd.org (Postfix) with ESMTP id CF7C68FC2E; Tue, 5 Oct 2010 08:56:02 +0000 (UTC) Received: from [178.92.255.63] (helo=laptop.levsha.me) by expo.ukrweb.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.71 (FreeBSD)) (envelope-from ) id 1P32re-000K5n-AU; Tue, 05 Oct 2010 11:27:15 +0300 Received: from levsha by laptop.levsha.me with local (Exim 4.72 (FreeBSD)) (envelope-from ) id 1P32rs-0002BU-EA; Tue, 05 Oct 2010 11:27:24 +0300 Date: Tue, 5 Oct 2010 11:27:24 +0300 From: Mykola Dzham To: kientzle@freebsd.org, freebsd-current@freebsd.org Message-ID: <20101005082723.GA2540@laptop.levsha.me> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GvXjxJ+pjyke8COw" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: Mykola Dzham X-SA-Exim-Connect-IP: 178.92.255.63 X-SA-Exim-Mail-From: i@levsha.me X-SA-Exim-Scanned: No (on expo.ukrweb.net); SAEximRunCond expanded to false Cc: Subject: bin/tar incorrectly parse '[^...]' patterns in --exclude X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2010 08:56:03 -0000 --GvXjxJ+pjyke8COw Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! bsd tar parse only '[!...]' as negate pattern, but gnu tar and bsd tar on 8-STABLE parse '[^...]' too: # uname -a FreeBSD laptop.levsha.me 9.0-CURRENT FreeBSD 9.0-CURRENT #4 r212602M: Wed S= ep 15 04:50:20 EEST 2010 root@laptop.levsha.me:/usr/obj/usr/src/sys/LEV= SHA amd64 # tar --version bsdtar 2.8.3 - libarchive 2.7.901a # tar -tzvf test.tbz -rw-r--r-- 0 levsha levsha 0 Oct 5 01:27 a -rw-r--r-- 0 levsha levsha 0 Oct 5 01:27 b -rw-r--r-- 0 levsha levsha 0 Oct 5 01:27 c -rw-r--r-- 0 levsha levsha 0 Oct 5 01:27 d # tar -tzvf test.tbz --exclude '[!a]'=20 -rw-r--r-- 0 levsha levsha 0 Oct 5 01:27 a # tar -tzvf test.tbz --exclude '[^a]' -rw-r--r-- 0 levsha levsha 0 Oct 5 01:27 b -rw-r--r-- 0 levsha levsha 0 Oct 5 01:27 c -rw-r--r-- 0 levsha levsha 0 Oct 5 01:27 d # gtar -tzvf test.tbz --exclude '[^a]' -rw-r--r-- levsha/levsha 0 2010-10-05 01:27 a # # uname -a FreeBSD levsha.kiev.xxx.com.ua 8.1-STABLE FreeBSD 8.1-STABLE #10 r212252: M= on Sep 6 13:12:07 EEST 2010 root@levsha.kiev.xxx.com.ua:/usr/obj/usr/s= rc/sys/LEVSHA i386 # tar --version bsdtar 2.7.0 - libarchive 2.7.0 # tar -tzvf test.tbz -rw-r--r-- 0 levsha levsha 0 5 =D6=CF=D7 01:27 a -rw-r--r-- 0 levsha levsha 0 5 =D6=CF=D7 01:27 b -rw-r--r-- 0 levsha levsha 0 5 =D6=CF=D7 01:27 c -rw-r--r-- 0 levsha levsha 0 5 =D6=CF=D7 01:27 d # tar -tzvf test.tbz --exclude '[!a]' -rw-r--r-- 0 levsha levsha 0 5 =D6=CF=D7 01:27 a # tar -tzvf test.tbz --exclude '[^a]' -rw-r--r-- 0 levsha levsha 0 5 =D6=CF=D7 01:27 a #=20 Fix: Index: usr.bin/tar/pathmatch.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- usr.bin/tar/pathmatch.c (revision 212602) +++ usr.bin/tar/pathmatch.c (working copy) @@ -35,7 +35,7 @@ =20 /* * Check whether a character 'c' is matched by a list specification [...]: - * * Leading '!' negates the class. + * * Leading '!' or '^' negates the class. * * - is a range of characters * * \ removes any special meaning for * @@ -60,7 +60,7 @@ (void)flags; /* UNUSED */ =20 /* If this is a negated class, return success for nomatch. */ - if (*p =3D=3D '!' && p < end) { + if ((*p =3D=3D '!' || *p =3D=3D '^') && p < end) { match =3D 0; nomatch =3D 1; ++p; --=20 LEFT-(UANIC|RIPE) JID: levsha@jabber.net.ua PGP fingerprint: 1BCD 7C80 2E04 7282 C944 B0E0 7E67 619E 4E72 9280 --GvXjxJ+pjyke8COw Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iQEcBAEBAgAGBQJMquFqAAoJEH5nYZ5OcpKAAogH/2FkLl3MSbRIHVYrVfHllJUr mLRiSJAUXMezUHS+gZwELYDw0IikXL6RBDdbzruNoR/CvaGSML+qKw1s27PCADQx /6D5/JDVHd0oSQe/gMQhBJrxWnOnJSfo+o9YoK0Re5+AmZWtOuwv0vQtDqb2z0Qc VQun9lJ2lsiIF7w+NkX0O6AOYtWDSTl04UoPtj7hQcONvx32NxaqX3Lj2/garrFV lzAHXbaWJRGqnDt7bd/bpuVaBvqHWU3J8RySqALFkixTVUx3o7uObIeJpej596GV U2/y+gybKEXQVwwY2QSENOLhnlJnl1P7kIoYHCasH3z2eYmtfk89u2ef/JWUVyQ= =zRg9 -----END PGP SIGNATURE----- --GvXjxJ+pjyke8COw--