From 5b68c177a480d3fb3c0f8c19f7eee142fd8b8905479048c091778cd84bbee6ba Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Mon, 9 Oct 2017 18:16:48 +0000 Subject: [PATCH] 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 --- ...ypp-return-error-invalid-package-ids.patch | 65 +++++++++++++++++++ PackageKit.changes | 6 ++ PackageKit.spec | 3 + 3 files changed, 74 insertions(+) create mode 100644 PK-zypp-return-error-invalid-package-ids.patch diff --git a/PK-zypp-return-error-invalid-package-ids.patch b/PK-zypp-return-error-invalid-package-ids.patch new file mode 100644 index 0000000..5c84b54 --- /dev/null +++ b/PK-zypp-return-error-invalid-package-ids.patch @@ -0,0 +1,65 @@ +From 6c97a7f05953e91b156fdb783e24357ed03b20c7 Mon Sep 17 00:00:00 2001 +From: Jonathan Kang +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( 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); diff --git a/PackageKit.changes b/PackageKit.changes index a7d6509..af4f10d 100644 --- a/PackageKit.changes +++ b/PackageKit.changes @@ -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 diff --git a/PackageKit.spec b/PackageKit.spec index 6d1a31e..b566be2 100644 --- a/PackageKit.spec +++ b/PackageKit.spec @@ -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