import libdnf-0.63.0-2.el8

This commit is contained in:
CentOS Sources 2021-08-09 18:22:45 +00:00 committed by Andrew Lukoshko
parent 9a4eaef084
commit 7ee9d690f6
4 changed files with 160 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From 4a8a3f410552c58dfafb384bb361c6e40bebff1d Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Wed, 21 Jul 2021 11:01:32 +0200
Subject: [PATCH] Fix: dnf_context_module_install: memory leaks
---
libdnf/dnf-context.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp
index 55af2b2..6cb0011 100644
--- a/libdnf/dnf-context.cpp
+++ b/libdnf/dnf-context.cpp
@@ -3486,7 +3486,10 @@ dnf_context_module_install(DnfContext * context, const char ** module_specs, GEr
}
for (const auto &nevra : modpkg->getArtifacts()) {
int epoch;
- char *name, *version, *release, *arch;
+ g_autofree char *name = nullptr;
+ g_autofree char *version = nullptr;
+ g_autofree char *release = nullptr;
+ g_autofree char *arch = nullptr;
if (hy_split_nevra(nevra.c_str(), &name, &epoch, &version, &release, &arch)) {
// this really should never happen; unless the modular repodata is corrupted
g_autofree char *errmsg = g_strdup_printf (_("Failed to parse module artifact NEVRA '%s'"), nevra.c_str());
--
libgit2 1.0.1

View File

@ -0,0 +1,91 @@
From 07416268889f95e1495fb3d7b856de1c502870ba Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Wed, 21 Jul 2021 11:15:50 +0200
Subject: [PATCH] covscan: remove unused vars, mark private func static, return values
The `begin` and `end` variables were not used
in `ModulePackageContainer::updateFailSafeData`. Removed.
The `checksum` in "utils.cpp" is a private (static) function.
Added check of return value of `dnf_copy_recursive` function in unit test.
In the `install` in the "goal-py.cpp" file:
Explicitly ignores the return values of `hy_goal_install` and
`hy_goal_install_optional`. The functions always return zero.
Explicitly ignores the return values of `hy_goal_install_selector` and
`hy_goal_install_selector_optional`. The `error` argument is used instead.
---
libdnf/module/ModulePackageContainer.cpp | 2 --
libdnf/utils/utils.cpp | 2 +-
python/hawkey/goal-py.cpp | 8 ++++----
tests/libdnf/module/ModulePackageContainerTest.cpp | 3 ++-
4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index c0ad126..efab497 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -1656,8 +1656,6 @@ void ModulePackageContainer::updateFailSafeData()
if (pImpl->activatedModules) {
std::vector<ModulePackage *> latest = pImpl->getLatestActiveEnabledModules();
- auto begin = fileNames.begin();
- auto end = fileNames.end();
if (g_mkdir_with_parents(pImpl->persistDir.c_str(), 0755) == -1) {
const char * errTxt = strerror(errno);
auto logger(Log::getLogger());
diff --git a/libdnf/utils/utils.cpp b/libdnf/utils/utils.cpp
index 450718d..15f5275 100644
--- a/libdnf/utils/utils.cpp
+++ b/libdnf/utils/utils.cpp
@@ -301,7 +301,7 @@ void decompress(const char * inPath, const char * outPath, mode_t outMode, const
fclose(inFile);
}
-void checksum(const char * type, const char * inPath, const char * checksum_valid, bool * valid_out, gchar ** calculated_out)
+static void checksum(const char * type, const char * inPath, const char * checksum_valid, bool * valid_out, gchar ** calculated_out)
{
GError * errP{nullptr};
gboolean valid;
diff --git a/python/hawkey/goal-py.cpp b/python/hawkey/goal-py.cpp
index 2641a1d..5bbb959 100644
--- a/python/hawkey/goal-py.cpp
+++ b/python/hawkey/goal-py.cpp
@@ -281,15 +281,15 @@ install(_GoalObject *self, PyObject *args, PyObject *kwds) try
if (flags & HY_WEAK_SOLV) {
if (pkg) {
- hy_goal_install_optional(self->goal, pkg);
+ (void)hy_goal_install_optional(self->goal, pkg);
} else {
- hy_goal_install_selector_optional(self->goal, sltr, &error);
+ (void)hy_goal_install_selector_optional(self->goal, sltr, &error);
}
} else {
if (pkg) {
- hy_goal_install(self->goal, pkg);
+ (void)hy_goal_install(self->goal, pkg);
} else {
- hy_goal_install_selector(self->goal, sltr, &error);
+ (void)hy_goal_install_selector(self->goal, sltr, &error);
}
}
return op_error2exc(error);
diff --git a/tests/libdnf/module/ModulePackageContainerTest.cpp b/tests/libdnf/module/ModulePackageContainerTest.cpp
index b2cf170..6360a0c 100644
--- a/tests/libdnf/module/ModulePackageContainerTest.cpp
+++ b/tests/libdnf/module/ModulePackageContainerTest.cpp
@@ -17,7 +17,8 @@ void ModulePackageContainerTest::setUp()
char *retptr = mkdtemp(tmpdir);
CPPUNIT_ASSERT(retptr);
char * etc_target = g_strjoin(NULL, tmpdir, "/etc", NULL);
- dnf_copy_recursive(TESTDATADIR "/modules/etc", etc_target, &error);
+ auto ret = dnf_copy_recursive(TESTDATADIR "/modules/etc", etc_target, &error);
+ g_assert_true(ret);
g_assert_no_error(error);
g_free(etc_target);
--
libgit2 1.0.1

View File

@ -0,0 +1,32 @@
From 263eee36afc0ae5c8f342f4b61038e91ee942b21 Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
Date: Thu, 22 Apr 2021 15:19:26 +0200
Subject: [PATCH] hawkey: surrogateescape error handler to decode UTF-8 strings (RhBug:1893176)
This ensures that libdnf does not raise UnicodeDecodeError when
accessing package with non UTF-8 file names.
= changelog =
msg: DNF does not fail on non UTF-8 file names in a package
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1893176
---
python/hawkey/iutil-py.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python/hawkey/iutil-py.cpp b/python/hawkey/iutil-py.cpp
index 56ccafd..57bef57 100644
--- a/python/hawkey/iutil-py.cpp
+++ b/python/hawkey/iutil-py.cpp
@@ -285,7 +285,7 @@ strlist_to_pylist(const char **slist)
return NULL;
for (const char **iter = slist; *iter; ++iter) {
- UniquePtrPyObject str(PyUnicode_FromString(*iter));
+ UniquePtrPyObject str(PyUnicode_DecodeUTF8(*iter, strlen(*iter), "surrogateescape"));
if (!str)
return NULL;
int rc = PyList_Append(list.get(), str.get());
--
libgit2 1.0.1

View File

@ -56,7 +56,7 @@
Name: libdnf
Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version}
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Library providing simplified C and Python API to libsolv
License: LGPLv2+
URL: https://github.com/rpm-software-management/libdnf
@ -80,6 +80,9 @@ Patch16: 0016-Fix-failing-unittest-caused-by-the-revert-of-new-mod.patch
Patch17: 0017-Modify-unit-test-after-change-of-handling-advisories.patch
Patch18: 0018-Adjust-module-error-formatting-function-for-original.patch
Patch19: 0019-Remove-redundant-test.patch
Patch20: 0020-Fix-dnf_context_module_install-memory-leaks.patch
Patch21: 0021-covscan-remove-unused-vars-mark-private-func-static-return-values.patch
Patch22: 0022-hawkey-surrogateescape-error-handler-to-decode-UTF-8-strings-RhBug1893176.patch
BuildRequires: cmake
BuildRequires: gcc
@ -324,6 +327,11 @@ popd
%endif
%changelog
* Tue Jul 27 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.63.0-2
- Fix: dnf_context_module_install: memory leaks
- covscan: remove unused vars, mark private func static, return values
- DNF does not fail on non UTF-8 file names in a package
* Wed May 19 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.63.0-1
- Update to 0.62.0
- Hardening: add signature check with rpmcliVerifySignatures (RhBug:1932079)