From owner-svn-src-all@FreeBSD.ORG Sat Feb 6 20:36:15 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 525D0106566B; Sat, 6 Feb 2010 20:36:15 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F24F8FC12; Sat, 6 Feb 2010 20:36:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o16KaF5Z032431; Sat, 6 Feb 2010 20:36:15 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o16KaFCc032427; Sat, 6 Feb 2010 20:36:15 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201002062036.o16KaFCc032427@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Feb 2010 20:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203569 - head/usr.bin/tar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2010 20:36:15 -0000 Author: kientzle Date: Sat Feb 6 20:36:14 2010 New Revision: 203569 URL: http://svn.freebsd.org/changeset/base/203569 Log: bsdtar doesn't actually know what compression is supported by libarchive and it should not pretend that it does. It should just pass along the user's request and handle an error if it's not supported. Modified: head/usr.bin/tar/bsdtar.c head/usr.bin/tar/write.c Modified: head/usr.bin/tar/bsdtar.c ============================================================================== --- head/usr.bin/tar/bsdtar.c Sat Feb 6 20:27:36 2010 (r203568) +++ head/usr.bin/tar/bsdtar.c Sat Feb 6 20:36:14 2010 (r203569) @@ -299,30 +299,18 @@ main(int argc, char **argv) bsdtar->optarg); break; case 'j': /* GNU tar */ -#if HAVE_LIBBZ2 if (bsdtar->create_compression != '\0') bsdtar_errc(1, 0, "Can't specify both -%c and -%c", opt, bsdtar->create_compression); bsdtar->create_compression = opt; -#else - bsdtar_warnc(0, - "bzip2 compression not supported by this version of bsdtar"); - usage(); -#endif break; case 'J': /* GNU tar 1.21 and later */ -#if HAVE_LIBLZMA if (bsdtar->create_compression != '\0') bsdtar_errc(1, 0, "Can't specify both -%c and -%c", opt, bsdtar->create_compression); bsdtar->create_compression = opt; -#else - bsdtar_warnc(0, - "xz compression not supported by this version of bsdtar"); - usage(); -#endif break; case 'k': /* GNU tar */ bsdtar->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE; @@ -338,17 +326,11 @@ main(int argc, char **argv) bsdtar->option_warn_links = 1; break; case OPTION_LZMA: -#if HAVE_LIBLZMA if (bsdtar->create_compression != '\0') bsdtar_errc(1, 0, "Can't specify both -%c and -%c", opt, bsdtar->create_compression); bsdtar->create_compression = opt; -#else - bsdtar_warnc(0, - "lzma compression not supported by this version of bsdtar"); - usage(); -#endif break; case 'm': /* SUSv2 */ bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_TIME; @@ -510,17 +492,11 @@ main(int argc, char **argv) set_mode(bsdtar, opt); break; case 'y': /* FreeBSD version of GNU tar */ -#if HAVE_LIBBZ2 if (bsdtar->create_compression != '\0') bsdtar_errc(1, 0, "Can't specify both -%c and -%c", opt, bsdtar->create_compression); bsdtar->create_compression = opt; -#else - bsdtar_warnc(0, - "bzip2 compression not supported by this version of bsdtar"); - usage(); -#endif break; case 'Z': /* GNU tar */ if (bsdtar->create_compression != '\0') @@ -530,17 +506,11 @@ main(int argc, char **argv) bsdtar->create_compression = opt; break; case 'z': /* GNU tar, star, many others */ -#if HAVE_LIBZ if (bsdtar->create_compression != '\0') bsdtar_errc(1, 0, "Can't specify both -%c and -%c", opt, bsdtar->create_compression); bsdtar->create_compression = opt; -#else - bsdtar_warnc(0, - "gzip compression not supported by this version of bsdtar"); - usage(); -#endif break; case OPTION_USE_COMPRESS_PROGRAM: bsdtar->compress_program = bsdtar->optarg; Modified: head/usr.bin/tar/write.c ============================================================================== --- head/usr.bin/tar/write.c Sat Feb 6 20:27:36 2010 (r203568) +++ head/usr.bin/tar/write.c Sat Feb 6 20:36:14 2010 (r203569) @@ -185,34 +185,33 @@ tar_mode_c(struct bsdtar *bsdtar) } else { switch (bsdtar->create_compression) { case 0: - archive_write_set_compression_none(a); + r = archive_write_set_compression_none(a); break; -#ifdef HAVE_LIBBZ2 case 'j': case 'y': - archive_write_set_compression_bzip2(a); + r = archive_write_set_compression_bzip2(a); break; -#endif -#ifdef HAVE_LIBLZMA case 'J': - archive_write_set_compression_xz(a); + r = archive_write_set_compression_xz(a); break; case OPTION_LZMA: - archive_write_set_compression_lzma(a); + r = archive_write_set_compression_lzma(a); break; -#endif -#ifdef HAVE_LIBZ case 'z': - archive_write_set_compression_gzip(a); + r = archive_write_set_compression_gzip(a); break; -#endif case 'Z': - archive_write_set_compression_compress(a); + r = archive_write_set_compression_compress(a); break; default: bsdtar_errc(1, 0, "Unrecognized compression option -%c", bsdtar->create_compression); } + if (r != ARCHIVE_OK) { + bsdtar_errc(1, 0, + "Unsupported compression option -%c", + bsdtar->create_compression); + } } if (ARCHIVE_OK != archive_write_set_options(a, bsdtar->option_options))