Compare commits

...

No commits in common. 'c9' and 'cs10' have entirely different histories.
c9 ... cs10

@ -1 +1 @@
3e76ff79089aebf9a503bdb82d59dc148c218d0f SOURCES/createrepo_c-0.20.1.tar.gz
dcab2b58d9b22446bfea227baa4b792fdd0e0678 SOURCES/createrepo_c-1.1.2.tar.gz

2
.gitignore vendored

@ -1 +1 @@
SOURCES/createrepo_c-0.20.1.tar.gz
SOURCES/createrepo_c-1.1.2.tar.gz

@ -0,0 +1,43 @@
From 424616d851d6fe58e89ae9b1b318853f8a899195 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 1 Jul 2024 15:30:31 +0200
Subject: [PATCH] Fix a file descriptor and memory leak in an error path of
cr_detect_compression()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Covscan reported:
createrepo_c-1.1.2/src/compression_wrapper.c:197: error[resourceLeak]: Resource leak: file
It's a real bug and this patch fixes it.
Resolves: https://issues.redhat.com/browse/RHEL-45645
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/compression_wrapper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c
index 60e8cbd..bcaa661 100644
--- a/src/compression_wrapper.c
+++ b/src/compression_wrapper.c
@@ -190,13 +190,13 @@ cr_detect_compression(const char *filename, GError **err)
}
size_t bytesRead = fread(magic, 1, sizeof(magic), file);
+ fclose(file);
if (bytesRead != sizeof(magic)) {
// Assume that if there's less than 5 bytes in the file, it's uncompressed
g_debug("%s: Unable to read bytes from file for magic number detection, assuming uncompressed (%s)",
__func__, filename);
return CR_CW_NO_COMPRESSION;
}
- fclose(file);
if (!memcmp(magic, "\x1F\x8B", 2)) {
return CR_CW_GZ_COMPRESSION;
--
2.45.2

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

@ -4,7 +4,9 @@
%global bash_completion %{_datadir}/bash-completion/completions/*
%if 0%{?rhel} && ( 0%{?rhel} <= 7 || 0%{?rhel} >= 9 )
# Fedora infrastructure needs it for producing Fedora ≤ 39 and EPEL ≤ 7 repositories
# See https://github.com/rpm-software-management/createrepo_c/issues/398
%if ( 0%{?rhel} && ( 0%{?rhel} <= 7 || 0%{?rhel} >= 9 ) ) || ( 0%{?fedora} && 0%{?fedora} >= 45 )
%bcond_with drpm
%else
%bcond_without drpm
@ -16,32 +18,41 @@
%bcond_without zchunk
%endif
%if 0%{?rhel} && 0%{?rhel} < 8
%if 0%{?rhel} && 0%{?rhel} < 7
%bcond_with libmodulemd
%else
%bcond_without libmodulemd
%endif
%if 0%{?rhel} && 0%{?rhel} <= 8
%bcond_without legacy_hashes
%else
%bcond_with legacy_hashes
%endif
%bcond_with sanitizers
Summary: Creates a common metadata repository
Name: createrepo_c
Version: 0.20.1
Release: 2%{?dist}
License: GPLv2+
Version: 1.1.2
Release: 4%{?dist}
License: GPL-2.0-or-later
URL: https://github.com/rpm-software-management/createrepo_c
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch1: 0001-Test_compare_contents_instead_of_checksum-cleanup.patch
Patch0: 0001-Fix-a-file-descriptor-and-memory-leak-in-an-error-pa.patch
%global epoch_dep %{?epoch:%{epoch}:}
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: bzip2-devel
BuildRequires: doxygen
BuildRequires: file-devel
BuildRequires: glib2-devel >= 2.22.0
BuildRequires: libcurl-devel
BuildRequires: libxml2-devel
BuildRequires: openssl-devel
BuildRequires: rpm-devel >= 4.8.0-28
BuildRequires: sqlite-devel
BuildRequires: sqlite-devel >= 3.6.18
BuildRequires: xz
BuildRequires: xz-devel
BuildRequires: zlib-devel
@ -51,19 +62,36 @@ BuildRequires: zchunk
%endif
%if %{with libmodulemd}
BuildRequires: pkgconfig(modulemd-2.0) >= %{libmodulemd_version}
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: libmodulemd2
Requires: libmodulemd2%{?_isa} >= %{libmodulemd_version}
%else
BuildRequires: libmodulemd
Requires: libmodulemd%{?_isa} >= %{libmodulemd_version}
%endif
Requires: %{name}-libs = %{version}-%{release}
%endif
Requires: %{name}-libs = %{epoch_dep}%{version}-%{release}
%if 0%{?fedora} > 40 || 0%{?rhel} > 10
BuildRequires: bash-completion-devel
%else
BuildRequires: bash-completion
%endif
Requires: rpm >= 4.9.0
%if %{with drpm}
BuildRequires: drpm-devel >= 0.4.0
%endif
# dnf supports zstd since 8.4: https://bugzilla.redhat.com/show_bug.cgi?id=1914876
BuildRequires: pkgconfig(libzstd)
%if %{with sanitizers}
BuildRequires: libasan
BuildRequires: liblsan
BuildRequires: libubsan
%endif
%if 0%{?fedora} || 0%{?rhel} > 7
Obsoletes: createrepo < 0.11.0
Provides: createrepo = %{version}-%{release}
Provides: createrepo = %{epoch_dep}%{version}-%{release}
%endif
%description
@ -81,7 +109,7 @@ for easy manipulation with a repodata.
%package devel
Summary: Library for repodata manipulation
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{epoch_dep}%{version}-%{release}
%description devel
This package contains the createrepo_c C library and header files.
@ -91,15 +119,16 @@ These development files are for easy manipulation with a repodata.
Summary: Python 3 bindings for the createrepo_c library
%{?python_provide:%python_provide python3-%{name}}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-sphinx
Requires: %{name}-libs = %{version}-%{release}
Requires: %{name}-libs = %{epoch_dep}%{version}-%{release}
%description -n python3-%{name}
Python 3 bindings for the createrepo_c library.
%prep
%autosetup -p1
%py3_shebang_fix examples/python
mkdir build-py3
%build
@ -108,7 +137,9 @@ pushd build-py3
%cmake .. \
-DWITH_ZCHUNK=%{?with_zchunk:ON}%{!?with_zchunk:OFF} \
-DWITH_LIBMODULEMD=%{?with_libmodulemd:ON}%{!?with_libmodulemd:OFF} \
-DENABLE_DRPM=%{?with_drpm:ON}%{!?with_drpm:OFF}
-DWITH_LEGACY_HASHES=%{?with_legacy_hashes:ON}%{!?with_legacy_hashes:OFF} \
-DENABLE_DRPM=%{?with_drpm:ON}%{!?with_drpm:OFF} \
-DWITH_SANITIZERS=%{?with_sanitizers:ON}%{!?with_sanitizers:OFF}
make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}"
# Build C documentation
make doc-c
@ -172,75 +203,175 @@ ln -sr %{buildroot}%{_bindir}/modifyrepo_c %{buildroot}%{_bindir}/modifyrepo
%{_includedir}/%{name}/
%files -n python3-%{name}
%doc examples/python/*
%{python3_sitearch}/%{name}/
%{python3_sitearch}/%{name}-%{version}-py%{python3_version}.egg-info
%changelog
* Mon Jun 26 2023 Jaroslav Rohel <jrohel@redhat.com> - 0.20.1-2
- Change test to compare contents instead of checksum, cleanup (RhBug:2130179)
* Thu Sep 22 2022 Lukas Hrazky <lhrazky@redhat.com> - 0.20.1-1
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.1.2-4
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Tue Jul 02 2024 Petr Pisar <ppisar@redhat.com> - 1.1.2-3
- Fix a file descriptor and a memory leak in an error path of
cr_detect_compression() (RHEL-45645)
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.1.2-2
- Bump release for June 2024 mass rebuild
* Wed May 29 2024 Petr Pisar <ppisar@redhat.com> - 1.1.2-1
- 1.1.2 bump (RHEL-38831)
* Tue May 28 2024 Petr Pisar <ppisar@redhat.com> - 1.1.1-1
- 1.1.1 bump (RHEL-38831)
- Package Python examples
* Tue Feb 20 2024 Jan Kolarik <jkolarik@redhat.com> - 1.0.4-1
- Update to 1.0.4 (RHEL-38831)
- Extend the --compatibility flag to cover other defaults
- mergerepo_c and modifyrepo_c now make "pretty" indented xml
- Fix building due to bash-completion repackaging
* Fri Jan 26 2024 Jan Kolarik <jkolarik@redhat.com> - 1.0.3-1
- Update to 1.0.3
- Set compression level 10 for zstd and zck
- Introduce new --no-pretty option to reduce metadata size
- Use gzip compression by default when --compatibility is specified
- Default changelog limit restored for --compatibility
- Use epoch-friendly sub-package interdependencies
- Enable sqlite shared cache on connection level
- Fix const-correctness with libxml2-2.12.0
- Allow specifying zck compression only
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Nov 24 2023 Petr Pisar <ppisar@redhat.com> - 1.0.2-3
- Restore compatiblity with libxml2-2.12.0
* Wed Nov 15 2023 Jan Kolarik <jkolarik@redhat.com> - 1.0.2-2
- Keep support for DRPM until Fedora 45 for infrastructure building
* Tue Nov 07 2023 Jan Kolarik <jkolarik@redhat.com> - 1.0.2-1
- Update to 1.0.2
- Drop support for DRPM in Fedora 39 and higher
- Don't allow building without zstd
- Fixes for PyPI wheel
- Fix building on EL9
- Adjust printf formats for 64bit time_t on 32bit systems
* Mon Oct 02 2023 Petr Pisar <ppisar@redhat.com> - 1.0.0-2
- Specify a dependency on libzstd as in an upstream
* Mon Jul 31 2023 Ales Matej <amatej@redhat.com> - 1.0.0-1
- Update to 1.0.0
- Keep location_base on update if no baseurl defined in args
- Add zstd compression support and make it the default
- Do not generate sqlite databases by default
- mergerepo_c: allow setting compression for repository
- Unify groupfile handling with other metadata types
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.21.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Wed Jun 14 2023 Python Maint <python-maint@redhat.com> - 0.21.1-3
- Rebuilt for Python 3.12
* Tue May 16 2023 Jan Kolarik <jkolarik@redhat.com> - 0.21.1-2
- Rebuild for rpm-4.18.90
* Tue Apr 04 2023 Jan Kolarik <jkolarik@redhat.com> - 0.21.1-1
- Update to 0.21.1
- Add --duplicated-nevra "keep-last" option, and --delayed-dump
- Add optional filelists-ext metadata
- Replace 'cp' binary execution with gio
- Fix errors while parsing utf8 chars in cli options
- Use g_pattern_spec_match() with glib >= 2.70.0
* Tue Feb 28 2023 Miro Hrončok <mhroncok@redhat.com> - 0.20.1-4
- BuildRequire python3-setuptools explicitly, don't assume they are pulled transitively
* Sat Feb 25 2023 Florian Weimer <fweimer@redhat.com> - 0.20.1-3
- Apply upstream patch to fix C99 compatibility issue
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.20.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Aug 17 2022 Jaroslav Rohel <jrohel@redhat.com> - 0.20.1-1
- Update to 0.20.1
- createrepo_c shouldn't silently produce duplicate-NEVRA repos
- Fix memory allocation in unescape_ampersand_from_values
- Fix GError messages - call g_strerror only once
- Fix bad performance with task queue management
- Update errno usage to fix incorrect GError messages
- Install header for createrepo_shared module
- Remove C API for cr_xml_parse_main_metadata_together
- Remove python bindings for xml_parse_main_metadata_together
- Return an error code and print a message when more than one package have the same NEVRA
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.20.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 0.20.0-2
- Rebuilt for Python 3.11
* Thu May 05 2022 Jaroslav Rohel <jrohel@redhat.com> - 0.20.0-1
- Update to 0.20.0
- Add a streaming parsing API that is user-controllable
- Fix '&' encoding in attributes when parsing repodata
- Add a streaming parsing API that is user-controllable.
- Fix a memory leak of primary pkg when parsing interrupted
- Fix a memory leak when removing the first link in a list
- Remove `allow_out_of_order` option for `xml_parse_main_metadata_together`
- Make parse warnings visible through cr.Repomd(), cr.UpdateInfo()
- Use --error-exit-val option by default
- If new and old repomd matches during --update don't update
- Add `cr_repomd_compare` for comparing two repomds
- Store parsed repomd in `cr_MetadataLocation`
- Set database version only for the database records, not everything
- Use copy+delete fallback when moving of a dir fails
- Fix memory leaks
- [spec] Option for legacy hashes, enable on RHEL <= 8 (RhBug:2022271)
- Remove python bindings for xml_parse_main_metadata_together (obsoleted by cr.PackageIterator)
- Remove C API for cr_xml_parse_main_metadata_together (obsoleted by cr_PkgIterator_new)
- Fix signature of pkg_iterator_next_package to prevent a warning
* Mon Jun 6 2022 Lukas Hrazky <lhrazky@redhat.com> - 0.17.7-4
- Revert addition of new API for parsing main metadata together (RhBug:2063141)
* Mon Mar 14 2022 Pavla Kratochvilova <pkratoch@redhat.com> - 0.19.0-1
- Fix memory leaks
- Fix a bug in cr_repomd_record_compress_and_fill()
- Zero init buffer to prevent use of garbage values if input is too short
- Use copy+delete fallback when moving of a dir fails
- Switch default of --keep-all-metadata to TRUE and add --discard-additional-metadata
- Set database version only for the database records, not everything
- If the new repodata generated during an --update run exactly matches the old repodata don't touch the files
- Use --error-exit-val option by default
* Wed Feb 16 2022 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.7-2
- Switch default of --keep-all-metadata to TRUE and add --discard-additional-metadata (RhBug:2055032)
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.17.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Oct 25 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.7-1
* Thu Oct 21 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.7-1
- Update to 0.17.7
- Remove insecure hashes SHA-1 and MD5 from the default build (RhBug:1935486)
- Remove insecure hashes SHA-1 and MD5 from the default build
* Thu Sep 16 2021 Sahana Prasad <sahana@redhat.com> - 0.17.5-2
- Rebuilt with OpenSSL 3.0.0
* Wed Sep 15 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.5-1
- Update to 0.17.5
- Fix error when updating repo with removed modules metadata
- Exit with status code 1 when loading of repo's metadata fails
- Fix memory leaks (RhBug:1998426)
- Fix valgrind warnings caused by subprocess calls
- Fix memory leaks and covscan warnings
* Mon Aug 16 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.2-5
- Fix issues detected by static analyzers
* Tue Sep 14 2021 Sahana Prasad <sahana@redhat.com> - 0.17.3-3
- Rebuilt with OpenSSL 3.0.0
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 0.17.2-4
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.17.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jul 27 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.2-3
- Fix spec conditional to enable libmodulemd in RHEL >= 8 (RhBug:1816753)
* Tue Jun 15 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.3-1
- Update to 0.17.3
- Fix valgrind warnings caused by subprocess calls
- Fix memory leak
* Wed Jun 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.17.2-2
- Rebuilt for RHEL 9 BETA for openssl 3.0
Related: rhbz#1971065
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.17.2-2
- Rebuilt for Python 3.10
* Mon Apr 26 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.17.2-1
* Thu Apr 15 2021 Nicola Sella <nsella@redhat.com> - 0.17.2-1
- Update to 0.17.2
- Fix Python deprecation (PY_SSIZE_T_CLEAN) (RhBug:1891785)
- Revert back to old c API for destination file of cr_compress_file_with_stat and cr_compress_file to prevent a memory leak
- Never leave behind .repodata lock on exit (RhBug:1906831)
- Disable drpm for RHEL >= 9 (RhBug:1914828)
- Setting updated/issued_date to None doesn't produce garbage values (RhBug:1921715)
- Remove empty arrays in tests, pass NULL instead (fixes a compiler war…
- Replace 'blacklist' with 'excludelist'
- Allow taking __repr__ (__str__) of closed xmlfile and sqlite (RhBug:1913465)
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 0.16.2-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
- Fix segmentation fault when taking str() of closed file
- Setting updated/issued_date to None - (RhBug:1921715)
- Drop Python 2 support
- Disable drpm also for RHEL >= 9 (RhBug:1914828)
- Never leave behind .repodata lock on exit (RhBug:1906831)
- Revert back to old API of cr_compress_file_with_stat and cr_compress
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

Loading…
Cancel
Save