From d1be20168d28b47070ad166e6ac97704b4c719d4 Mon Sep 17 00:00:00 2001 From: Michihiro NAKAJIMA Date: Fri, 5 Oct 2012 11:33:14 +0900 Subject: [PATCH] When zlib is not available, use "gzip -d" insted of gunzip because gzip is widely available than gunzip is. --- cpio/test/main.c | 15 --------------- cpio/test/test.h | 3 --- libarchive/archive_read_support_filter_gzip.c | 2 +- libarchive/test/main.c | 15 --------------- libarchive/test/test.h | 3 --- libarchive/test/test_read_compress_program.c | 4 ++-- .../test/test_read_filter_program_signature.c | 4 ++-- libarchive/test/test_write_compress_program.c | 12 ++++++------ tar/test/main.c | 15 --------------- tar/test/test.h | 3 --- tar/test/test_extract_tar_gz.c | 2 +- 11 files changed, 12 insertions(+), 66 deletions(-) diff --git a/cpio/test/main.c b/cpio/test/main.c index ac0347529..36cb84870 100644 --- a/cpio/test/main.c +++ b/cpio/test/main.c @@ -1872,21 +1872,6 @@ canGzip(void) return (value); } -/* - * Can this platform run the gunzip program? - */ -int -canGunzip(void) -{ - static int tested = 0, value = 0; - if (!tested) { - tested = 1; - if (systemf("gunzip -V %s", redirectArgs) == 0) - value = 1; - } - return (value); -} - /* * Can this platform run the lrzip program? */ diff --git a/cpio/test/test.h b/cpio/test/test.h index 88c7c2438..45fa650d4 100644 --- a/cpio/test/test.h +++ b/cpio/test/test.h @@ -272,9 +272,6 @@ int canBunzip2(void); /* Return true if this platform can run the "gzip" program. */ int canGzip(void); -/* Return true if this platform can run the "gunzip" program. */ -int canGunzip(void); - /* Return true if this platform can run the "lrzip" program. */ int canLrzip(void); diff --git a/libarchive/archive_read_support_filter_gzip.c b/libarchive/archive_read_support_filter_gzip.c index f6d5595f0..4cbdb0374 100644 --- a/libarchive/archive_read_support_filter_gzip.c +++ b/libarchive/archive_read_support_filter_gzip.c @@ -231,7 +231,7 @@ gzip_bidder_init(struct archive_read_filter *self) { int r; - r = __archive_read_program(self, "gunzip"); + r = __archive_read_programl(self, "gzip", "gzip", "-d", NULL); /* Note: We set the format here even if __archive_read_program() * above fails. We do, after all, know what the format is * even if we weren't able to read it. */ diff --git a/libarchive/test/main.c b/libarchive/test/main.c index f9db14437..3ea900763 100644 --- a/libarchive/test/main.c +++ b/libarchive/test/main.c @@ -1870,21 +1870,6 @@ canGzip(void) return (value); } -/* - * Can this platform run the gunzip program? - */ -int -canGunzip(void) -{ - static int tested = 0, value = 0; - if (!tested) { - tested = 1; - if (systemf("gunzip -V %s", redirectArgs) == 0) - value = 1; - } - return (value); -} - /* * Can this platform run the lrzip program? */ diff --git a/libarchive/test/test.h b/libarchive/test/test.h index eee985df4..163ea324f 100644 --- a/libarchive/test/test.h +++ b/libarchive/test/test.h @@ -272,9 +272,6 @@ int canBunzip2(void); /* Return true if this platform can run the "gzip" program. */ int canGzip(void); -/* Return true if this platform can run the "gunzip" program. */ -int canGunzip(void); - /* Return true if this platform can run the "lrzip" program. */ int canLrzip(void); diff --git a/libarchive/test/test_read_compress_program.c b/libarchive/test/test_read_compress_program.c index 92f7aed30..8734563e5 100644 --- a/libarchive/test/test_read_compress_program.c +++ b/libarchive/test/test_read_compress_program.c @@ -61,8 +61,8 @@ DEFINE_TEST(test_read_compress_program) /* * If we have "gzip -d", try using that. */ - if (!canGunzip()) { - skipping("Can't run gunzip program on this platform"); + if (!canGzip()) { + skipping("Can't run gzip program on this platform"); return; } assert((a = archive_read_new()) != NULL); diff --git a/libarchive/test/test_read_filter_program_signature.c b/libarchive/test/test_read_filter_program_signature.c index 0512560ee..4f966a252 100644 --- a/libarchive/test/test_read_filter_program_signature.c +++ b/libarchive/test/test_read_filter_program_signature.c @@ -64,8 +64,8 @@ DEFINE_TEST(test_read_filter_program_signature) /* * If we have "gzip -d", try using that. */ - if (!canGunzip()) { - skipping("Can't run gunzip program on this platform"); + if (!canGzip()) { + skipping("Can't run gzip program on this platform"); return; } assert((a = archive_read_new()) != NULL); diff --git a/libarchive/test/test_write_compress_program.c b/libarchive/test/test_write_compress_program.c index 63908aca6..36a650dd3 100644 --- a/libarchive/test/test_write_compress_program.c +++ b/libarchive/test/test_write_compress_program.c @@ -47,7 +47,7 @@ DEFINE_TEST(test_write_compress_program) * yield the extra bytes when using gunzip. */ assert((a = archive_read_new()) != NULL); r = archive_read_support_filter_gzip(a); - if (r != ARCHIVE_OK && canGunzip()) + if (r != ARCHIVE_OK && canGzip()) blocksize = 1; assertEqualInt(ARCHIVE_OK, archive_read_free(a)); @@ -95,7 +95,7 @@ DEFINE_TEST(test_write_compress_program) /* The compression_gzip() handler will fall back to gunzip * automatically, but if we know gunzip isn't available, then * skip the rest. */ - if (r != ARCHIVE_OK && !canGunzip()) { + if (r != ARCHIVE_OK && !canGzip()) { skipping("No libz and no gunzip program, " "unable to verify gzip compression"); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); @@ -141,7 +141,7 @@ DEFINE_TEST(test_write_compress_programl) * yield the extra bytes when using gunzip. */ assert((a = archive_read_new()) != NULL); r = archive_read_support_filter_gzip(a); - if (r != ARCHIVE_OK && canGunzip()) + if (r != ARCHIVE_OK && canGzip()) blocksize = 1; assertEqualInt(ARCHIVE_OK, archive_read_free(a)); @@ -189,7 +189,7 @@ DEFINE_TEST(test_write_compress_programl) /* The compression_gzip() handler will fall back to gunzip * automatically, but if we know gunzip isn't available, then * skip the rest. */ - if (r != ARCHIVE_OK && !canGunzip()) { + if (r != ARCHIVE_OK && !canGzip()) { skipping("No libz and no gunzip program, " "unable to verify gzip compression"); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); @@ -236,7 +236,7 @@ DEFINE_TEST(test_write_compress_programv) * yield the extra bytes when using gunzip. */ assert((a = archive_read_new()) != NULL); r = archive_read_support_filter_gzip(a); - if (r != ARCHIVE_OK && canGunzip()) + if (r != ARCHIVE_OK && canGzip()) blocksize = 1; assertEqualInt(ARCHIVE_OK, archive_read_free(a)); @@ -284,7 +284,7 @@ DEFINE_TEST(test_write_compress_programv) /* The compression_gzip() handler will fall back to gunzip * automatically, but if we know gunzip isn't available, then * skip the rest. */ - if (r != ARCHIVE_OK && !canGunzip()) { + if (r != ARCHIVE_OK && !canGzip()) { skipping("No libz and no gunzip program, " "unable to verify gzip compression"); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); diff --git a/tar/test/main.c b/tar/test/main.c index 140939321..42cf272d3 100644 --- a/tar/test/main.c +++ b/tar/test/main.c @@ -1872,21 +1872,6 @@ canGzip(void) return (value); } -/* - * Can this platform run the gunzip program? - */ -int -canGunzip(void) -{ - static int tested = 0, value = 0; - if (!tested) { - tested = 1; - if (systemf("gunzip -V %s", redirectArgs) == 0) - value = 1; - } - return (value); -} - /* * Can this platform run the lrzip program? */ diff --git a/tar/test/test.h b/tar/test/test.h index 05d99c2a2..dc23fc96a 100644 --- a/tar/test/test.h +++ b/tar/test/test.h @@ -274,9 +274,6 @@ int canBunzip2(void); /* Return true if this platform can run the "gzip" program. */ int canGzip(void); -/* Return true if this platform can run the "gunzip" program. */ -int canGunzip(void); - /* Return true if this platform can run the "lrzip" program. */ int canLrzip(void); diff --git a/tar/test/test_extract_tar_gz.c b/tar/test/test_extract_tar_gz.c index ba5fdec66..2fdb4ba7c 100644 --- a/tar/test/test_extract_tar_gz.c +++ b/tar/test/test_extract_tar_gz.c @@ -32,7 +32,7 @@ DEFINE_TEST(test_extract_tar_gz) extract_reference_file(reffile); f = systemf("%s -tf %s >test.out 2>test.err", testprog, reffile); - if (f == 0 || canGunzip()) { + if (f == 0 || canGzip()) { assertEqualInt(0, systemf("%s -xf %s >test.out 2>test.err", testprog, reffile)); -- 2.47.2