Blame 0001-Test_compare_contents_instead_of_checksum-cleanup.patch

Jaroslav Rohel 92c111
From 3b69916685cd1dc1a64a59d9e1b90921de91e2d0 Mon Sep 17 00:00:00 2001
Jaroslav Rohel 92c111
From: Daniel Alley <dalley@redhat.com>
Jaroslav Rohel 92c111
Date: Fri, 13 Jan 2023 00:06:12 -0500
Jaroslav Rohel 92c111
Subject: [PATCH] Change test to compare contents instead of checksum
Jaroslav Rohel 92c111
Jaroslav Rohel 92c111
Different implementations of the DEFLATE algorithm can produce different
Jaroslav Rohel 92c111
(but equally valid) gzip files. This can cause test failure if a
Jaroslav Rohel 92c111
different implementation (e.g. hardware acceleration) is used.
Jaroslav Rohel 92c111
---
Jaroslav Rohel 92c111
 tests/test_misc.c | 11 ++++++-----
Jaroslav Rohel 92c111
 1 file changed, 6 insertions(+), 5 deletions(-)
Jaroslav Rohel 92c111
Jaroslav Rohel 92c111
diff --git a/tests/test_misc.c b/tests/test_misc.c
Jaroslav Rohel 92c111
index 6614809..f8025cb 100644
Jaroslav Rohel 92c111
--- a/tests/test_misc.c
Jaroslav Rohel 92c111
+++ b/tests/test_misc.c
Jaroslav Rohel 92c111
@@ -544,19 +544,20 @@ compressfile_test_text_file(Copyfiletest *copyfiletest,
Jaroslav Rohel 92c111
                             G_GNUC_UNUSED gconstpointer test_data)
Jaroslav Rohel 92c111
 {
Jaroslav Rohel 92c111
     int ret;
Jaroslav Rohel 92c111
-    char *checksum;
Jaroslav Rohel 92c111
     GError *tmp_err = NULL;
Jaroslav Rohel 92c111
 
Jaroslav Rohel 92c111
     g_assert(!g_file_test(copyfiletest->dst_file, G_FILE_TEST_EXISTS));
Jaroslav Rohel 92c111
+
Jaroslav Rohel 92c111
     ret = cr_compress_file(TEST_TEXT_FILE, copyfiletest->dst_file,
Jaroslav Rohel 92c111
                            CR_CW_GZ_COMPRESSION, NULL, FALSE, &tmp_err);
Jaroslav Rohel 92c111
     g_assert(!tmp_err);
Jaroslav Rohel 92c111
     g_assert_cmpint(ret, ==, CRE_OK);
Jaroslav Rohel 92c111
     g_assert(g_file_test(copyfiletest->dst_file, G_FILE_TEST_IS_REGULAR));
Jaroslav Rohel 92c111
-    checksum = cr_checksum_file(copyfiletest->dst_file, CR_CHECKSUM_SHA256, NULL);
Jaroslav Rohel 92c111
-    g_assert_cmpstr(checksum, ==, "8909fde88a5747d800fd2562b0f22945f014aa7df64"
Jaroslav Rohel 92c111
-                                  "cf1c15c7933ae54b72ab6");
Jaroslav Rohel 92c111
-    g_free(checksum);
Jaroslav Rohel 92c111
+
Jaroslav Rohel 92c111
+    // assert content is readable after compression and decompression
Jaroslav Rohel 92c111
+    char buf[30];
Jaroslav Rohel 92c111
+    read_file(copyfiletest->dst_file, CR_CW_GZ_COMPRESSION, buf, 30);
Jaroslav Rohel 92c111
+    g_assert(g_strrstr(buf, "Lorem ipsum dolor sit amet"));
Jaroslav Rohel 92c111
 }
Jaroslav Rohel 92c111
 
Jaroslav Rohel 92c111
 
Jaroslav Rohel 92c111
-- 
Jaroslav Rohel 92c111
2.40.1
Jaroslav Rohel 92c111
Jaroslav Rohel 92c111
Jaroslav Rohel 92c111
From 7844b63d932f36084a927b3cc8900cc0971436f3 Mon Sep 17 00:00:00 2001
Jaroslav Rohel 92c111
From: Daniel Alley <dalley@redhat.com>
Jaroslav Rohel 92c111
Date: Fri, 13 Jan 2023 12:52:42 -0500
Jaroslav Rohel 92c111
Subject: [PATCH] Remove 11 year old polyfill
Jaroslav Rohel 92c111
Jaroslav Rohel 92c111
---
Jaroslav Rohel 92c111
 src/compression_wrapper.c | 7 +------
Jaroslav Rohel 92c111
 1 file changed, 1 insertion(+), 6 deletions(-)
Jaroslav Rohel 92c111
Jaroslav Rohel 92c111
diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c
Jaroslav Rohel 92c111
index 15e9e38..b23c345 100644
Jaroslav Rohel 92c111
--- a/src/compression_wrapper.c
Jaroslav Rohel 92c111
+++ b/src/compression_wrapper.c
Jaroslav Rohel 92c111
@@ -86,11 +86,6 @@ LZMA_CHECK_SHA256
Jaroslav Rohel 92c111
 #define XZ_DECODER_FLAGS        0
Jaroslav Rohel 92c111
 #define XZ_BUFFER_SIZE          (1024*32)
Jaroslav Rohel 92c111
 
Jaroslav Rohel 92c111
-#if ZLIB_VERNUM < 0x1240
Jaroslav Rohel 92c111
-// XXX: Zlib has gzbuffer since 1.2.4
Jaroslav Rohel 92c111
-#define gzbuffer(a,b) 0
Jaroslav Rohel 92c111
-#endif
Jaroslav Rohel 92c111
-
Jaroslav Rohel 92c111
 cr_ContentStat *
Jaroslav Rohel 92c111
 cr_contentstat_new(cr_ChecksumType type, GError **err)
Jaroslav Rohel 92c111
 {
Jaroslav Rohel 92c111
@@ -1549,7 +1544,7 @@ cr_printf(GError **err, CR_FILE *cr_file, const char *format, ...)
Jaroslav Rohel 92c111
     return ret;
Jaroslav Rohel 92c111
 }
Jaroslav Rohel 92c111
 
Jaroslav Rohel 92c111
-ssize_t 
Jaroslav Rohel 92c111
+ssize_t
Jaroslav Rohel 92c111
 cr_get_zchunk_with_index(CR_FILE *cr_file, ssize_t zchunk_index, char **copy_buf, GError **err)
Jaroslav Rohel 92c111
 {
Jaroslav Rohel 92c111
     assert(cr_file);
Jaroslav Rohel 92c111
-- 
Jaroslav Rohel 92c111
2.40.1
Jaroslav Rohel 92c111
Jaroslav Rohel 92c111
Jaroslav Rohel 92c111
From ad34359fbcaefb6fd5053a56b0472572ea2270b5 Mon Sep 17 00:00:00 2001
Jaroslav Rohel 92c111
From: Daniel Alley <dalley@redhat.com>
Jaroslav Rohel 92c111
Date: Fri, 13 Jan 2023 13:05:16 -0500
Jaroslav Rohel 92c111
Subject: [PATCH] Fix compile warning, off by one
Jaroslav Rohel 92c111
Jaroslav Rohel 92c111
closes #337
Jaroslav Rohel 92c111
---
Jaroslav Rohel 92c111
 src/checksum.c | 2 +-
Jaroslav Rohel 92c111
 1 file changed, 1 insertion(+), 1 deletion(-)
Jaroslav Rohel 92c111
Jaroslav Rohel 92c111
diff --git a/src/checksum.c b/src/checksum.c
Jaroslav Rohel 92c111
index ef420a1..1ae2a54 100644
Jaroslav Rohel 92c111
--- a/src/checksum.c
Jaroslav Rohel 92c111
+++ b/src/checksum.c
Jaroslav Rohel 92c111
@@ -49,7 +49,7 @@ cr_checksum_type(const char *name)
Jaroslav Rohel 92c111
     if (len > MAX_CHECKSUM_NAME_LEN)
Jaroslav Rohel 92c111
         return CR_CHECKSUM_UNKNOWN;
Jaroslav Rohel 92c111
 
Jaroslav Rohel 92c111
-    for (size_t x = 0; x <= len; x++)
Jaroslav Rohel 92c111
+    for (size_t x = 0; x < len; x++)
Jaroslav Rohel 92c111
         name_lower[x] = tolower(name[x]);
Jaroslav Rohel 92c111
 
Jaroslav Rohel 92c111
     if (!strncmp(name_lower, "sha", 3)) {
Jaroslav Rohel 92c111
-- 
Jaroslav Rohel 92c111
2.40.1
Jaroslav Rohel 92c111