Blame SOURCES/0001-Libmagic-to-follow-symlinks-RhBug1776399.patch

eb9c9f
From 566311457542d08f48507b0ab7bd68cb848594e9 Mon Sep 17 00:00:00 2001
eb9c9f
From: Marek Blaha <mblaha@redhat.com>
eb9c9f
Date: Fri, 29 Nov 2019 09:47:29 +0100
eb9c9f
Subject: [PATCH 1/2] Libmagic to follow symlinks (RhBug:1776399)
eb9c9f
eb9c9f
If the input metadata file for modifyrepo_c was a symlink the
eb9c9f
program failed to detect compression type. This patch instructs
eb9c9f
libmagic to follow the symlinks when guessing the mime type.
eb9c9f
eb9c9f
Let modules.yaml be a symlink:
eb9c9f
eb9c9f
$ modifyrepo_c ./modules.yaml ./repodata
eb9c9f
Cannot open ./modules.yaml: Cannot detect compression type
eb9c9f
eb9c9f
https://bugzilla.redhat.com/show_bug.cgi?id=1776399
eb9c9f
---
eb9c9f
 src/compression_wrapper.c | 2 +-
eb9c9f
 1 file changed, 1 insertion(+), 1 deletion(-)
eb9c9f
eb9c9f
diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c
eb9c9f
index d04ab24..6fdb8ea 100644
eb9c9f
--- a/src/compression_wrapper.c
eb9c9f
+++ b/src/compression_wrapper.c
eb9c9f
@@ -166,7 +166,7 @@ cr_detect_compression(const char *filename, GError **err)
eb9c9f
 
eb9c9f
     // No success? Let's get hardcore... (Use magic bytes)
eb9c9f
 
eb9c9f
-    magic_t myt = magic_open(MAGIC_MIME);
eb9c9f
+    magic_t myt = magic_open(MAGIC_MIME | MAGIC_SYMLINK);
eb9c9f
     if (myt == NULL) {
eb9c9f
         g_set_error(err, ERR_DOMAIN, CRE_MAGIC,
eb9c9f
                     "magic_open() failed: Cannot allocate the magic cookie");
eb9c9f
eb9c9f
From b1b849c3bd63424760152981f96031ef578d752c Mon Sep 17 00:00:00 2001
eb9c9f
From: Marek Blaha <mblaha@redhat.com>
eb9c9f
Date: Fri, 29 Nov 2019 10:53:25 +0100
eb9c9f
Subject: [PATCH 2/2] Add shortcut to detect *.yaml files as not compressed
eb9c9f
eb9c9f
---
eb9c9f
 src/compression_wrapper.c | 2 +-
eb9c9f
 1 file changed, 1 insertion(+), 1 deletion(-)
eb9c9f
eb9c9f
diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c
eb9c9f
index 6fdb8ea..56d1dc5 100644
eb9c9f
--- a/src/compression_wrapper.c
eb9c9f
+++ b/src/compression_wrapper.c
eb9c9f
@@ -158,12 +158,12 @@ cr_detect_compression(const char *filename, GError **err)
eb9c9f
         return CR_CW_ZCK_COMPRESSION;
eb9c9f
     } else if (g_str_has_suffix(filename, ".xml") ||
eb9c9f
                g_str_has_suffix(filename, ".tar") ||
eb9c9f
+               g_str_has_suffix(filename, ".yaml") ||
eb9c9f
                g_str_has_suffix(filename, ".sqlite"))
eb9c9f
     {
eb9c9f
         return CR_CW_NO_COMPRESSION;
eb9c9f
     }
eb9c9f
 
eb9c9f
-
eb9c9f
     // No success? Let's get hardcore... (Use magic bytes)
eb9c9f
 
eb9c9f
     magic_t myt = magic_open(MAGIC_MIME | MAGIC_SYMLINK);