Date: Sunday, June 13, 2021 @ 12:07:00 Author: raster Revision: 963276
fix various bugs gracked by upstream pkgbuild fixing various issues at https://github.com/PackageKit/PackageKit/pull/487 Added: packagekit/trunk/0016-alpm-fix-uninitialized-stack-vars-used-later-in-conf.patch packagekit/trunk/0017-alpm-fix-missing-handling-of-hookdir-in-pacman.conf.patch packagekit/trunk/0018-alpm-fix-get-update-detail-which-uses-totally-wrong-.patch Modified: packagekit/trunk/PKGBUILD -----------------------------------------------------------------+ 0016-alpm-fix-uninitialized-stack-vars-used-later-in-conf.patch | 29 ++ 0017-alpm-fix-missing-handling-of-hookdir-in-pacman.conf.patch | 54 +++++ 0018-alpm-fix-get-update-detail-which-uses-totally-wrong-.patch | 100 ++++++++++ PKGBUILD | 14 + 4 files changed, 194 insertions(+), 3 deletions(-) Added: 0016-alpm-fix-uninitialized-stack-vars-used-later-in-conf.patch =================================================================== --- 0016-alpm-fix-uninitialized-stack-vars-used-later-in-conf.patch (rev 0) +++ 0016-alpm-fix-uninitialized-stack-vars-used-later-in-conf.patch 2021-06-13 12:07:00 UTC (rev 963276) @@ -0,0 +1,29 @@ +From 763a046849ded07e3785d76b8af24381b44aadc1 Mon Sep 17 00:00:00 2001 +From: "Carsten Haitzler (Rasterman)" <[email protected]> +Date: Sun, 13 Jun 2021 12:13:30 +0100 +Subject: [PATCH 1/2] alpm - fix uninitialized stack vars used later in config + +In the parsing of siglevel, depending on content this can leave +level and mask sometimes unset as the code likes to take current value +and val | newbitval to set bits, assuming it starts at 0. This fixes +that. +--- + backends/alpm/pk-alpm-config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/backends/alpm/pk-alpm-config.c b/backends/alpm/pk-alpm-config.c +index 01081106c..3fbb60c18 100644 +--- a/backends/alpm/pk-alpm-config.c ++++ b/backends/alpm/pk-alpm-config.c +@@ -793,7 +793,7 @@ static gboolean + pk_alpm_config_configure_repos (PkBackend *backend, PkAlpmConfig *config, + alpm_handle_t *handle, GError **error) + { +- alpm_siglevel_t base, level, mask, local, remote; ++ alpm_siglevel_t base, level = 0, mask = 0, local, remote; + const alpm_list_t *i; + PkAlpmConfigSection *options; + +-- +2.31.1 + Added: 0017-alpm-fix-missing-handling-of-hookdir-in-pacman.conf.patch =================================================================== --- 0017-alpm-fix-missing-handling-of-hookdir-in-pacman.conf.patch (rev 0) +++ 0017-alpm-fix-missing-handling-of-hookdir-in-pacman.conf.patch 2021-06-13 12:07:00 UTC (rev 963276) @@ -0,0 +1,54 @@ +From f2d1163b3c965b8b61f98460ff68d6cd94aae1a0 Mon Sep 17 00:00:00 2001 +From: "Carsten Haitzler (Rasterman)" <[email protected]> +Date: Sun, 13 Jun 2021 12:15:18 +0100 +Subject: [PATCH 2/2] alpm - fix missing handling of hookdir in pacman.conf + +The pacman.conf parser didnt handle HookDir at all. This fixes that +and handles it. +--- + backends/alpm/pk-alpm-config.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/backends/alpm/pk-alpm-config.c b/backends/alpm/pk-alpm-config.c +index 3fbb60c18..3bce61a52 100644 +--- a/backends/alpm/pk-alpm-config.c ++++ b/backends/alpm/pk-alpm-config.c +@@ -47,7 +47,7 @@ typedef struct + + alpm_list_t *cachedirs, *holdpkgs, *ignoregroups, + *ignorepkgs, *localfilesiglevels, *noextracts, +- *noupgrades, *remotefilesiglevels; ++ *noupgrades, *remotefilesiglevels, *hookdirs; + + alpm_list_t *sections; + GRegex *xrepo, *xarch; +@@ -106,6 +106,7 @@ pk_alpm_config_free (PkAlpmConfig *config) + FREELIST (config->noextracts); + FREELIST (config->noupgrades); + FREELIST (config->remotefilesiglevels); ++ FREELIST (config->hookdirs); + + alpm_list_free_inner (config->sections, pk_alpm_config_section_free); + alpm_list_free (config->sections); +@@ -360,6 +361,7 @@ static const PkAlpmConfigList pk_alpm_config_list_options[] = { + { "NoUpgrade", G_STRUCT_OFFSET (PkAlpmConfig, noupgrades) }, + { "RemoteFileSigLevel", G_STRUCT_OFFSET (PkAlpmConfig, + remotefilesiglevels) }, ++ { "HookDir", G_STRUCT_OFFSET (PkAlpmConfig, hookdirs) }, + { NULL, 0 } + }; + +@@ -997,6 +999,10 @@ pk_alpm_config_configure_alpm (PkBackend *backend, PkAlpmConfig *config, GError + alpm_option_set_noupgrades (handle, config->noupgrades); + config->noupgrades = NULL; + ++ /* alpm takes ownership */ ++ alpm_option_set_noupgrades (handle, config->hookdirs); ++ config->hookdirs = NULL; ++ + pk_alpm_config_configure_repos (backend, config, handle, error); + + return handle; +-- +2.31.1 + Added: 0018-alpm-fix-get-update-detail-which-uses-totally-wrong-.patch =================================================================== --- 0018-alpm-fix-get-update-detail-which-uses-totally-wrong-.patch (rev 0) +++ 0018-alpm-fix-get-update-detail-which-uses-totally-wrong-.patch 2021-06-13 12:07:00 UTC (rev 963276) @@ -0,0 +1,100 @@ +From 6e3ea5b0cfdaec125472fc2132767f4fc8c92a65 Mon Sep 17 00:00:00 2001 +From: "Carsten Haitzler (Rasterman)" <[email protected]> +Date: Sun, 13 Jun 2021 12:59:26 +0100 +Subject: [PATCH] alpm - fix get-update-detail which uses totally wrong list of + strings + +pk_backend_get_update_detail_thread() passed in single stirngs instead +of null pointer terminated lists (arrays) of strings thus the null +terminator was junk on the stack... this fixes that/ updates is a +single string anyway so thus fake an array of 2 eleemtns and replaces +was all wrong trying to munge multiple replaces into a single string +insted of producing a proper array of them. +--- + backends/alpm/pk-alpm-update.c | 35 +++++++++++++++++----------------- + 1 file changed, 17 insertions(+), 18 deletions(-) + +diff --git a/backends/alpm/pk-alpm-update.c b/backends/alpm/pk-alpm-update.c +index aa641c02b..4071a10f6 100644 +--- a/backends/alpm/pk-alpm-update.c ++++ b/backends/alpm/pk-alpm-update.c +@@ -39,33 +39,32 @@ + #include "pk-alpm-transaction.h" + #include "pk-alpm-update.h" + +-static gchar * ++static gchar ** + pk_alpm_pkg_build_replaces (PkBackendJob *job, alpm_pkg_t *pkg) + { + PkBackend *backend = pk_backend_job_get_backend (job); + PkBackendAlpmPrivate *priv = pk_backend_get_user_data (backend); + const alpm_list_t *i; +- GString *string = NULL; ++ gchar **replaces = NULL; ++ gint count = 0; + + g_return_val_if_fail (pkg != NULL, NULL); + + /* make a list of the packages that package replaces */ + for (i = alpm_pkg_get_replaces (pkg); i != NULL; i = i->next) { +- alpm_pkg_t *replaces = alpm_db_get_pkg (priv->localdb, i->data); +- +- if (replaces != NULL) { +- g_autofree gchar *package = pk_alpm_pkg_build_id (replaces); +- if (string == NULL) { +- string = g_string_new (package); +- } else { +- g_string_append_printf (string, "&%s", package); ++ alpm_pkg_t *package = alpm_db_get_pkg (priv->localdb, i->data); ++ ++ if (package != NULL) { ++ gchar *id = pk_alpm_pkg_build_id (package); ++ if (id) { ++ replaces = g_realloc (replaces, ((++count) + 1) * sizeof(gchar *)); ++ replaces[count - 1] = id; ++ replaces[count] = NULL; + } + } + } + +- if (string == NULL) +- return NULL; +- return g_string_free (string, FALSE); ++ return replaces; + } + + static gchar ** +@@ -143,8 +142,8 @@ pk_backend_get_update_detail_thread (PkBackendJob *job, GVariant* params, gpoint + PkRestartEnum restart = PK_RESTART_ENUM_NONE; + PkUpdateStateEnum state = PK_UPDATE_STATE_ENUM_STABLE; + alpm_time_t built, installed; +- g_autofree gchar *upgrades = NULL; +- g_autofree gchar *replaces = NULL; ++ g_autofree gchar *upgrades[2] = { NULL, NULL }; ++ g_autofree gchar **replaces; + g_auto(GStrv) urls = NULL; + g_autofree gchar *issued = NULL; + g_autofree gchar *updated = NULL; +@@ -158,7 +157,7 @@ pk_backend_get_update_detail_thread (PkBackendJob *job, GVariant* params, gpoint + + old = alpm_db_get_pkg (priv->localdb, alpm_pkg_get_name (pkg)); + if (old != NULL) { +- upgrades = pk_alpm_pkg_build_id (old); ++ upgrades[0] = pk_alpm_pkg_build_id (old); + if (pk_alpm_pkg_same_pkgver (pkg, old)) { + reason = "Update to a newer release"; + } else { +@@ -188,8 +187,8 @@ pk_backend_get_update_detail_thread (PkBackendJob *job, GVariant* params, gpoint + updated = pk_alpm_time_to_iso8601 (installed); + } + +- pk_backend_job_update_detail (job, *packages, &upgrades, +- &replaces, urls, NULL, NULL, ++ pk_backend_job_update_detail (job, *packages, upgrades, ++ replaces, urls, NULL, NULL, + restart, reason, NULL, state, + issued, updated); + } +-- +2.31.1 + Modified: PKGBUILD =================================================================== --- PKGBUILD 2021-06-13 11:47:18 UTC (rev 963275) +++ PKGBUILD 2021-06-13 12:07:00 UTC (rev 963276) @@ -11,7 +11,7 @@ license=('GPL') makedepends=('polkit' 'sqlite' 'gobject-introspection' 'intltool' 'bash-completion' 'vala' 'meson') -options=('!emptydirs') +options=('!emptydirs' '!strip') validpgpkeys=('163EB50119225DB3DF8F49EA17ACBA8DFA970E17' # Richard Hughes <[email protected]> 'EC60AABDF42AAE8FB062640480858FA38F62AF74') # Kalev Lember <[email protected]> source=("https://www.freedesktop.org/software/PackageKit/releases/PackageKit-${pkgver}.tar.xz" @@ -29,7 +29,11 @@ 0012-alpm-fix-warning-about-fallthrough-be-explicit-about.patch 0013-build-fix-overall-sysconfdir-handling-so-it-can-work.patch 0014-Fix-get-updates.patch - 0015-support-new-pacman-options.patch) + 0015-support-new-pacman-options.patch + 0016-alpm-fix-uninitialized-stack-vars-used-later-in-conf.patch + 0017-alpm-fix-missing-handling-of-hookdir-in-pacman.conf.patch + 0018-alpm-fix-get-update-detail-which-uses-totally-wrong-.patch + ) sha256sums=('d3bef282f8b45963618adb69ed5199f23640b00b98ead66291ae30cff8068e4a' '3c4d5a2658c9ed28ff949f7a2aa0c99e1a85e63f7fd0b068d3b9278ace503c16' '258ff42a2c0f9dd5d609785d5535af35294c5940b63936fa32fdc4cff4b3151d' @@ -45,7 +49,10 @@ 'a2ff81d619e0e9be87188c046367581b61d5756d294012cb886431454afbe249' '0188f015890681acdded08a2372cf6963a5b9436e98734dcab07b9d0147310c9' '2e7e542a6115f3ed993c71c63bf41206552f6028282778c7f90fdfb2fd9eebe8' - '2012114520c304b78340dfd33e87862d0a2e973d51c3dadd8e6cf0483a041735') + '2012114520c304b78340dfd33e87862d0a2e973d51c3dadd8e6cf0483a041735' + 'a7ae42bbf5a1d4995d2b4f483a78791da57a41d1bcc2ddd52370c8fa19430282' + '589102648833adbda34f46b7b2c1e1849892fda36d5721eed3e36ea6e349156c' + '5e433fa6dff406b085ccee8a6f52af5a26daf9a1892c91e14b0bd00cb70cf191') prepare() { for _patch in *.patch; do @@ -64,6 +71,7 @@ -Dsystemd=true ) +export CFLAGS="-O0 -g" arch-meson "PackageKit-$pkgver" build "${_meson_options[@]}" ninja -C build
