]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
When zlib is not available, use "gzip -d" insted of gunzip
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Fri, 5 Oct 2012 02:33:14 +0000 (11:33 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Fri, 5 Oct 2012 02:33:14 +0000 (11:33 +0900)
because gzip is widely available than gunzip is.

cpio/test/main.c
cpio/test/test.h
libarchive/archive_read_support_filter_gzip.c
libarchive/test/main.c
libarchive/test/test.h
libarchive/test/test_read_compress_program.c
libarchive/test/test_read_filter_program_signature.c
libarchive/test/test_write_compress_program.c
tar/test/main.c
tar/test/test.h
tar/test/test_extract_tar_gz.c

index ac03475297973db6f597f7c260966674e0509beb..36cb84870a0748e4bc7a91946f32252e7e5f2b36 100644 (file)
@@ -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?
  */
index 88c7c243811efed8c044f3730e5d726b6af5a88b..45fa650d4d38f0ce1b8966962966c50c3eb090ca 100644 (file)
@@ -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);
 
index f6d5595f0b6b5b47df8bf54ab76f312a1bf50565..4cbdb037456b69cbb674ba71ba23c2dc3ccc1f74 100644 (file)
@@ -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. */
index f9db144377e8cfe0e03aa7c7fdb06ce527a7c2f5..3ea9007634cfbdb6988573bc8e646898b6801bf6 100644 (file)
@@ -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?
  */
index eee985df4c1b408d041e74126344add766812099..163ea324f9712475359b8a5e496234dabfde4151 100644 (file)
@@ -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);
 
index 92f7aed309c903657265d6263180ea8c0a42a529..8734563e51df44e2ab813bae5a4f9293051cde85 100644 (file)
@@ -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);
index 0512560ee587ab86673b15023764c40a8ea421d0..4f966a252a8f470a3a4f96223d13c14678c9afdc 100644 (file)
@@ -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);
index 63908aca6423bc956ab550900231de4c2b810a6f..36a650dd348c918bf15ae27dc157b681ae10b660 100644 (file)
@@ -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));
index 140939321f2e07d4f303e9b1883d7a104316dbf3..42cf272d386dab55aa5d51db4d144052f61e4e04 100644 (file)
@@ -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?
  */
index 05d99c2a248bb68a23a43abf892a71899b20ee12..dc23fc96a488992df4c3c8e648451260147468a8 100644 (file)
@@ -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);
 
index ba5fdec66ff5b9306c141bfd98929438eaa5ed79..2fdb4ba7cdff194172291274df611d5ad057ed76 100644 (file)
@@ -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));