Update to 0.11.0

This commit is contained in:
Marek Blaha 2018-06-27 12:12:32 +02:00
parent 57df2f647e
commit 8a3ee40250
6 changed files with 7 additions and 206 deletions

1
.gitignore vendored
View File

@ -39,3 +39,4 @@
/createrepo_c-7b68123.tar.xz /createrepo_c-7b68123.tar.xz
/createrepo_c-7a74bb7.tar.xz /createrepo_c-7a74bb7.tar.xz
/createrepo_c-0.10.0.tar.gz /createrepo_c-0.10.0.tar.gz
/createrepo_c-0.11.0.tar.gz

View File

@ -1,61 +0,0 @@
From f1a7d9b5e7ee493133daf608adaf80b10a87b915 Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <puiterwijk@redhat.com>
Date: Mon, 26 Sep 2016 12:45:25 +0000
Subject: [PATCH 1/2] Make set_record act like a setter
This will make sure that when set_record is called, all existing
records of the same type are removed.
It makes no sense to have multiple records of the same type,
and it actively breaks libhifs checksum validation.
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
---
src/repomd.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/repomd.c b/src/repomd.c
index fea2c7e..3e79ccf 100644
--- a/src/repomd.c
+++ b/src/repomd.c
@@ -682,6 +682,14 @@ cr_repomd_set_record(cr_Repomd *repomd,
cr_RepomdRecord *record)
{
if (!repomd || !record) return;
+
+ cr_RepomdRecord *delrec = NULL;
+ // Remove all existing record of the same type
+ while((delrec = cr_repomd_get_record(repomd, record->type)) != NULL) {
+ cr_repomd_detach_record(repomd, delrec);
+ cr_repomd_record_free(delrec);
+ }
+
repomd->records = g_slist_append(repomd->records, record);
}
From 5e44d23842d68e31e92498edeb6aba2e72a63abd Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <puiterwijk@redhat.com>
Date: Mon, 26 Sep 2016 12:48:31 +0000
Subject: [PATCH 2/2] Add test to make sure that set_record overrides the
current record
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
---
tests/python/tests/test_repomd.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/python/tests/test_repomd.py b/tests/python/tests/test_repomd.py
index 283dedc..6b6b3ad 100644
--- a/tests/python/tests/test_repomd.py
+++ b/tests/python/tests/test_repomd.py
@@ -99,6 +99,10 @@ def test_repomd(self):
self.assertEqual(len(md.records), 1)
+ md.set_record(rec)
+
+ self.assertEqual(len(md.records), 1)
+
md.repoid = None
md.contenthash = None

View File

@ -1,66 +0,0 @@
From 35ae4edd9a6abef11fbdbfef5e717ba6eee6f8ee Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <puiterwijk@redhat.com>
Date: Wed, 28 Sep 2016 12:09:07 +0000
Subject: [PATCH] Close BZ2 compressed files on cr_close
Per bzip2 documentation: "BZ2_bzReadClose does not call fclose on the underlying file
handle, so you should do that yourself if appropriate.".
This patch adds a INNERFILE element to CR_FILE to keep track of the FILE object so we
can properly close the file on cr_close.
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
---
src/compression_wrapper.c | 6 ++++++
src/compression_wrapper.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c
index aacaf90..adc2f39 100644
--- a/src/compression_wrapper.c
+++ b/src/compression_wrapper.c
@@ -347,6 +347,7 @@ cr_sopen(const char *filename,
file = g_malloc0(sizeof(CR_FILE));
file->mode = mode;
file->type = type;
+ file->INNERFILE = NULL;
switch (type) {
@@ -380,6 +381,7 @@ cr_sopen(const char *filename,
case (CR_CW_BZ2_COMPRESSION): { // ------------------------------------
FILE *f = fopen(filename, mode_str);
+ file->INNERFILE = f;
int bzerror;
if (!f) {
@@ -405,6 +407,8 @@ cr_sopen(const char *filename,
if (bzerror != BZ_OK) {
const char *err_msg;
+ fclose(f);
+
switch (bzerror) {
case BZ_CONFIG_ERROR:
err_msg = "library has been mis-compiled";
@@ -642,6 +646,8 @@ cr_close(CR_FILE *cr_file, GError **err)
BZ2_bzWriteClose(&rc, (BZFILE *) cr_file->FILE,
BZ2_SKIP_FFLUSH, NULL, NULL);
+ fclose(cr_file->INNERFILE);
+
if (rc == BZ_OK) {
ret = CRE_OK;
} else {
diff --git a/src/compression_wrapper.h b/src/compression_wrapper.h
index 910fd45..65022d9 100644
--- a/src/compression_wrapper.h
+++ b/src/compression_wrapper.h
@@ -79,6 +79,7 @@ void cr_contentstat_free(cr_ContentStat *cstat, GError **err);
typedef struct {
cr_CompressionType type; /*!< Type of compression */
void *FILE; /*!< Pointer to gzFile, BZFILE, ... */
+ void *INNERFILE; /*!< Pointer to underlying FILE */
cr_OpenMode mode; /*!< Mode */
cr_ContentStat *stat; /*!< Content stats */
cr_ChecksumCtx *checksum_ctx; /*!< Checksum contenxt */

View File

@ -1,72 +0,0 @@
From 3519f493ce51bac53d178f7ff9e5b84ca98a158a Mon Sep 17 00:00:00 2001
From: Tomas Mlcoch <tmlcoch@redhat.com>
Date: Fri, 19 Aug 2016 14:59:26 +0200
Subject: [PATCH 1/2] cr_lock_repo: Fix segfault caused by freed
tmp_repodata_dir variable
---
src/createrepo_shared.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/createrepo_shared.c b/src/createrepo_shared.c
index 5872029..d4df86c 100644
--- a/src/createrepo_shared.c
+++ b/src/createrepo_shared.c
@@ -258,12 +258,11 @@ cr_lock_repo(const gchar *repo_dir,
g_debug("(--ignore-lock enabled) For data generation is used: %s",
tmp_repodata_dir);
}
- }
- if (tmp_repodata_dir)
*tmp_repodata_dir_p = g_strdup(tmp_repodata_dir);
- else
+ } else {
*tmp_repodata_dir_p = g_strdup(lock_dir);
+ }
return TRUE;
}
--
2.9.3
From 07f5cce3eff5c62f0c16143c7eaab64eb0e3ebf8 Mon Sep 17 00:00:00 2001
From: Tomas Mlcoch <tmlcoch@redhat.com>
Date: Thu, 8 Sep 2016 09:45:38 +0200
Subject: [PATCH 2/2] cr_lock_repo: Fix double free (RhBz: 1355720)
---
src/createrepo_shared.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/createrepo_shared.c b/src/createrepo_shared.c
index d4df86c..8a26787 100644
--- a/src/createrepo_shared.c
+++ b/src/createrepo_shared.c
@@ -188,7 +188,6 @@ cr_lock_repo(const gchar *repo_dir,
assert(!err || *err == NULL);
_cleanup_free_ gchar *lock_dir = NULL;
- _cleanup_free_ gchar *tmp_repodata_dir = NULL;
_cleanup_error_free_ GError *tmp_err = NULL;
lock_dir = g_build_filename(repo_dir, ".repodata/", NULL);
@@ -242,10 +241,11 @@ cr_lock_repo(const gchar *repo_dir,
}
// To data generation use a different one
+ _cleanup_free_ gchar *tmp_repodata_dir = NULL;
_cleanup_free_ gchar *tmp = NULL;
- tmp_repodata_dir = g_build_filename(repo_dir, ".repodata.", NULL);
- tmp = cr_append_pid_and_datetime(tmp_repodata_dir, "/");
- tmp_repodata_dir = tmp;
+
+ tmp = g_build_filename(repo_dir, ".repodata.", NULL);
+ tmp_repodata_dir = cr_append_pid_and_datetime(tmp, "/");
if (g_mkdir(tmp_repodata_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) {
g_critical("(--ignore-lock enabled) Cannot create %s: %s",
--
2.9.3

View File

@ -25,16 +25,12 @@
Summary: Creates a common metadata repository Summary: Creates a common metadata repository
Name: createrepo_c Name: createrepo_c
Version: 0.10.0 Version: 0.11.0
Release: 21%{?dist} Release: 1%{?dist}
License: GPLv2+ License: GPLv2+
URL: https://github.com/rpm-software-management/createrepo_c URL: https://github.com/rpm-software-management/createrepo_c
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch0: createrepo_c-0.10.0-ignorelock-doublefree.patch
Patch1: https://patch-diff.githubusercontent.com/raw/rpm-software-management/createrepo_c/pull/64.patch
Patch2: https://patch-diff.githubusercontent.com/raw/rpm-software-management/createrepo_c/pull/66.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc BuildRequires: gcc
BuildRequires: bzip2-devel BuildRequires: bzip2-devel
@ -227,6 +223,9 @@ ln -sr %{buildroot}%{_bindir}/modifyrepo_c %{buildroot}%{_bindir}/modifyrepo
%endif %endif
%changelog %changelog
* Wed Jun 27 2018 Marek Blaha <mblaha@redhat.com> - 0.11.0-1
- Update to 0.11.0
* Mon Jun 18 2018 Miro Hrončok <mhroncok@redhat.com> - 0.10.0-21 * Mon Jun 18 2018 Miro Hrončok <mhroncok@redhat.com> - 0.10.0-21
- Rebuilt for Python 3.7 - Rebuilt for Python 3.7

View File

@ -1 +1 @@
2e14b3e5d289875b894000ab1e54f1ec createrepo_c-0.10.0.tar.gz SHA512 (createrepo_c-0.11.0.tar.gz) = b03b218695a0b3e204f601698be6f61f476a790f5602da52e73de89ab0d7754814b8627fd298b66474474bd47e14bbaf3f2cab4c6546dd9966ea6e1f9afd191c