import osinfo-db-tools-1.5.0-4.el8

This commit is contained in:
CentOS Sources 2019-11-05 14:03:33 -05:00 committed by Andrew Lukoshko
parent b961c76eb8
commit 7d5777e992
7 changed files with 238 additions and 5 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/osinfo-db-tools-1.2.0.tar.gz
SOURCES/osinfo-db-tools-1.5.0.tar.gz

View File

@ -1 +1 @@
963349c78a49f083a07091815a4894bb672fd81d SOURCES/osinfo-db-tools-1.2.0.tar.gz
859f5ee44bde621da7da3ed90b52d5848baf3004 SOURCES/osinfo-db-tools-1.5.0.tar.gz

View File

@ -0,0 +1,53 @@
From ab1b0bf0f3611b556627f42e5accb1063acd91cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Mon, 20 May 2019 14:19:01 +0200
Subject: [PATCH 1/3] import: Don't call unlink(NULL)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Although `man 3 unlink` doesn't mention what should be the unlink()
behaviour when NULL is passed to it, both coverity and clang complains
about that.
Error: FORWARD_NULL (CWE-476):
osinfo-db-tools-1.5.0/tools/osinfo-db-import.c:157: var_compare_op:
Comparing "*source_file" to null implies that "*source_file" might be
null.
osinfo-db-tools-1.5.0/tools/osinfo-db-import.c:181: var_deref_model:
Passing null pointer "*source_file" to "unlink", which dereferences it.
# 179| g_error_free(err);
# 180| if (ret != 0)
# 181|-> unlink(*source_file);
# 182|
# 183| return ret;
Error: CLANG_WARNING:
osinfo-db-tools-1.5.0/tools/osinfo-db-import.c:181:9: warning: Null
pointer passed as an argument to a 'nonnull' parameter
# unlink(*source_file);
# ^
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 07be7309d830419c27ec65c76905d1e23219f480)
---
tools/osinfo-db-import.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/osinfo-db-import.c b/tools/osinfo-db-import.c
index 920f71b..11e68ae 100644
--- a/tools/osinfo-db-import.c
+++ b/tools/osinfo-db-import.c
@@ -177,7 +177,7 @@ osinfo_db_import_download_file(GFile *file,
g_object_unref(out);
if (err != NULL)
g_error_free(err);
- if (ret != 0)
+ if (ret != 0 && *source_file != NULL)
unlink(*source_file);
return ret;
--
2.21.0

View File

@ -0,0 +1,62 @@
From 125f04cb6d742fb13f691cfbff54437014a399bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Mon, 20 May 2019 14:25:34 +0200
Subject: [PATCH 2/3] export: Remove unused variable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
err is declared, set to NULL, but never used in
osinfo_db_export_create().
Error: DEADCODE (CWE-561):
osinfo-db-tools-1.5.0/tools/osinfo-db-export.c:410: assignment:
Assigning: "err" = "NULL".
osinfo-db-tools-1.5.0/tools/osinfo-db-export.c:448: null: At condition
"err", the value of "err" must be "NULL".
osinfo-db-tools-1.5.0/tools/osinfo-db-export.c:448: dead_error_condition:
The condition "err" cannot be true.
osinfo-db-tools-1.5.0/tools/osinfo-db-export.c:449: dead_error_line:
Execution cannot reach this statement: "g_error_free(err);".
osinfo-db-tools-1.5.0/tools/osinfo-db-export.c:449: effectively_constant:
Local variable "err" is assigned only once, to a constant value, making
it effectively constant throughout its scope. If this is not the intent,
examine the logic to see if there is a missing assigment that would make
"err" not remain constant.
# 447| archive_write_free(arc);
# 448| if (err)
# 449|-> g_error_free(err);
# 450| return ret;
# 451| }
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 2d747c637c78c000002f97880436d94cc08a6b5c)
---
tools/osinfo-db-export.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/tools/osinfo-db-export.c b/tools/osinfo-db-export.c
index 3137e1d..eef6688 100644
--- a/tools/osinfo-db-export.c
+++ b/tools/osinfo-db-export.c
@@ -407,7 +407,6 @@ static int osinfo_db_export_create(const gchar *prefix,
struct archive *arc;
int ret = -1;
int r;
- GError *err = NULL;
arc = archive_write_new();
@@ -445,8 +444,6 @@ static int osinfo_db_export_create(const gchar *prefix,
ret = 0;
cleanup:
archive_write_free(arc);
- if (err)
- g_error_free(err);
return ret;
}
--
2.21.0

View File

@ -0,0 +1,36 @@
From f4f65ea3e895eaab87af049300d2d69ba3d51c9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Mon, 20 May 2019 14:28:22 +0200
Subject: [PATCH 3/3] validate: Don't leak "files"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Error: CLANG_WARNING:
osinfo-db-tools-1.5.0/tools/osinfo-db-validate.c:319:9: warning:
Potential leak of memory pointed to by 'files'
# g_printerr("%s\n", error->message);
# ^
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 7ac63b928df3f445ede81cac0ade0ed6d810c3cb)
---
tools/osinfo-db-validate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c
index 0e28e1c..7fd87d2 100644
--- a/tools/osinfo-db-validate.c
+++ b/tools/osinfo-db-validate.c
@@ -327,6 +327,7 @@ gint main(gint argc, gchar **argv)
g_object_unref(schema);
if (dir)
g_object_unref(dir);
+ g_free(files);
g_clear_error(&error);
g_option_context_free(context);
--
2.21.0

View File

@ -0,0 +1,43 @@
From 66cdd50832a99e175079bfb36a321fd9499c6f0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Wed, 22 May 2019 18:06:28 +0200
Subject: [PATCH] import: Don't call unlink(NULL) in _import_extract()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Similarly to the issue fixed by ae52b0fbc, here we're also potentially
passing NULL to unlink().
Error: FORWARD_NULL (CWE-476):
osinfo-db-tools-1.5.0/tools/osinfo-db-import.c:332: var_compare_op: Comparing "source_file" to null implies that "source_file" might be null.
osinfo-db-tools-1.5.0/tools/osinfo-db-import.c:374: var_deref_model: Passing null pointer "source_file" to "unlink", which dereferences it.
# 372| g_object_unref(file);
# 373| if (!file_is_native)
# 374|-> unlink(source_file);
# 375| g_free(source_file);
# 376| return ret;
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 69eb33ad4207c76c0738bfa00b40c97892bab0ad)
---
tools/osinfo-db-import.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/osinfo-db-import.c b/tools/osinfo-db-import.c
index 11e68ae..675961d 100644
--- a/tools/osinfo-db-import.c
+++ b/tools/osinfo-db-import.c
@@ -370,7 +370,7 @@ static int osinfo_db_import_extract(GFile *target,
archive_read_free(arc);
if (file)
g_object_unref(file);
- if (!file_is_native)
+ if (!file_is_native && source_file != NULL)
unlink(source_file);
g_free(source_file);
return ret;
--
2.21.0

View File

@ -2,17 +2,29 @@
Summary: Tools for managing the osinfo database
Name: osinfo-db-tools
Version: 1.2.0
Release: 1%{?dist}
Version: 1.5.0
Release: 4%{?dist}
License: GPLv2+
Source: https://fedorahosted.org/releases/l/i/libosinfo/%{name}-%{version}.tar.gz
Source: https://releases.pagure.io/libosinfo/%{name}-%{version}.tar.gz
URL: http://libosinfo.org/
### Patches ###
Patch0001: 0001-import-Don-t-call-unlink-NULL.patch
Patch0002: 0002-export-Remove-unused-variable.patch
Patch0003: 0003-validate-Don-t-leak-files.patch
Patch0004: 0004-import-Don-t-call-unlink-NULL-in-_import_extract.patch
BuildRequires: intltool
BuildRequires: glib2-devel
BuildRequires: libxml2-devel >= 2.6.0
BuildRequires: libxslt-devel >= 1.0.0
BuildRequires: libarchive-devel
BuildRequires: /usr/bin/pod2man
BuildRequires: json-glib-devel
BuildRequires: python3
BuildRequires: python3-pytest
BuildRequires: python3-requests
Requires: gvfs
%description
This package provides tools for managing the osinfo database of
@ -21,10 +33,21 @@ information about operating systems for use with virtualization
%prep
%setup -q
for p in %patches ; do
%__patch -p1 -i $p
done
%build
%configure
%__make %{?_smp_mflags} V=1
%check
if ! make check
then
cat tests/test-suite.log || true
exit 1
fi
%install
%__make install DESTDIR=%{buildroot}
@ -43,6 +66,22 @@ information about operating systems for use with virtualization
%{_mandir}/man1/osinfo-db-validate.1*
%changelog
* Wed May 22 2019 Fabiano Fidêncio <fidencio@redhat.com> - 1.5.0-4
- Related: rhbz#1712426 - New defects found in
osinfo-db-tools-1.5.0-2.el8
* Wed May 22 2019 Fabiano Fidêncio <fidencio@redhat.com> - 1.5.0-3
- Resolves: rhbz#1712426 - New defects found in
osinfo-db-tools-1.5.0-2.el8
* Mon May 20 2019 Fabiano Fidêncio <fidencio@redhat.com> - 1.5.0-2
- Resolves: rhbz#1681879 - osinfo-db-tools changes blocked until gating
tests are added
* Fri May 10 2019 Fabiano Fidêncio <fidencio@redhat.com> - 1.5.0-1
- Update to 1.3.0 release
- Resolves: rhbz#1699989 - Rebase to the latest upstream release
* Wed Jun 20 2018 Daniel P. Berrangé <berrange@redhat.com> - 1.2.0-1
- Update to 1.2.0 release