Accepting request 532632 from home:JonathanKang:branches:GNOME:Factory

- Add PK-zypp-return-error-invalid-package-ids.patch: Return error
  if invalid package IDs are detected in zypp backend (bsc#981011).

OBS-URL: https://build.opensuse.org/request/show/532632
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/PackageKit?expand=0&rev=300
This commit is contained in:
Dominique Leuenberger 2017-10-09 18:16:48 +00:00 committed by Git OBS Bridge
parent 5ff1b4b177
commit 5b68c177a4
3 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,65 @@
From 6c97a7f05953e91b156fdb783e24357ed03b20c7 Mon Sep 17 00:00:00 2001
From: Jonathan Kang <jonathan121537@gmail.com>
Date: Mon, 7 Aug 2017 14:48:37 +0800
Subject: [PATCH] zypp: Return error if invalid package IDs are detected
---
backends/zypp/pk-backend-zypp.cpp | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
Index: PackageKit-1.1.7/backends/zypp/pk-backend-zypp.cpp
===================================================================
--- PackageKit-1.1.7.orig/backends/zypp/pk-backend-zypp.cpp
+++ PackageKit-1.1.7/backends/zypp/pk-backend-zypp.cpp
@@ -1805,7 +1805,7 @@ pk_backend_destroy (PkBackend *backend)
static bool
zypp_is_no_solvable (const sat::Solvable &solv)
{
- return solv.id() == sat::detail::noSolvableId;
+ return solv == sat::Solvable::noSolvable;
}
/**
@@ -2111,6 +2111,13 @@ backend_get_details_thread (PkBackendJob
sat::Solvable solv = zypp_get_package_by_id( package_ids[i] );
+ if (zypp_is_no_solvable(solv)) {
+ // Previously stored package_id no longer matches any solvable.
+ zypp_backend_finished_error (job, PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
+ "couldn't find package");
+ return;
+ }
+
ResObject::constPtr obj = make<ResObject>( solv );
if (obj == NULL) {
zypp_backend_finished_error (job, PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
@@ -2584,6 +2591,13 @@ backend_install_packages_thread (PkBacke
for (guint i = 0; package_ids[i]; i++) {
MIL << package_ids[i] << endl;
sat::Solvable solvable = zypp_get_package_by_id (package_ids[i]);
+
+ if (zypp_is_no_solvable(solvable)) {
+ // Previously stored package_id no longer matches any solvable.
+ zypp_backend_finished_error (job, PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
+ "couldn't find package");
+ return;
+ }
to_install++;
PoolItem item(solvable);
@@ -3222,6 +3236,14 @@ backend_update_packages_thread (PkBacken
for (guint i = 0; package_ids[i]; i++) {
sat::Solvable solvable = zypp_get_package_by_id (package_ids[i]);
+
+ if (zypp_is_no_solvable(solvable)) {
+ // Previously stored package_id no longer matches any solvable.
+ zypp_backend_finished_error (job, PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
+ "couldn't find package");
+ return;
+ }
+
ui::Selectable::Ptr sel( ui::Selectable::get( solvable ));
PoolItem item(solvable);

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Oct 9 02:20:58 UTC 2017 - sckang@suse.com
- Add PK-zypp-return-error-invalid-package-ids.patch: Return error
if invalid package IDs are detected in zypp backend (bsc#981011).
-------------------------------------------------------------------
Wed Sep 20 14:56:55 UTC 2017 - fcrozat@suse.com

View File

@ -34,6 +34,8 @@ Source99: PackageKit.keyring
Patch0: PackageKit-avoid-endless-loop-on-autoupdate.patch
# PATCH-FIX-OPENSUSE PackageKit-zypp-backend-improve-refresh-cache.patch bsc#899755 sckang@suse.com -- Improve refresh-cache function in zypp backend.
Patch1: PackageKit-zypp-backend-improve-refresh-cache.patch
# PATCH-FIX-UPSTREAM PK-zypp-return-error-invalid-package-ids.patch bsc#981011 sckang@suse.com -- zypp: Return error if invalid package IDs are detected
Patch2: PK-zypp-return-error-invalid-package-ids.patch
BuildRequires: NetworkManager-devel
# Needed in order to be able to bootstrap (patch2)
BuildRequires: autoconf-archive
@ -223,6 +225,7 @@ This package provides the upstream default configuration for PackageKit.
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%if !0%{?is_opensuse}
translation-update-upstream
%endif