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