diff --git a/0001-Set-NEWEST-flag-when-resolving-packages-with-Package.patch b/0001-Set-NEWEST-flag-when-resolving-packages-with-Package.patch new file mode 100644 index 0000000..e8ba689 --- /dev/null +++ b/0001-Set-NEWEST-flag-when-resolving-packages-with-Package.patch @@ -0,0 +1,47 @@ +From fa6dd59c5eaabc8c7e540f2aa2ded6f785de0a13 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Wed, 20 Feb 2019 11:12:04 -0800 +Subject: [PATCH] Set 'NEWEST' flag when resolving packages with PackageKit + +When resolving package names via PackageKit, realmd does not set +the PK_FILTER_ENUM_NEWEST flag that asks PK to only give the +*newest available* package for each package name. So if there +are three different versions of the package available in three +repositories, realmd winds up producing an array containing the +package IDs for all three of those packages and calling +InstallPackages on all of them. I don't know if PK's behaviour +in this case is defined or predictable, but in practice in at +least one case it reliably results in one of the older package +versions being installed. + +This does not seem desirable, we should always want to install +the newest available version. So let's set the NEWEST flag to +ensure this. + +A possible consequence here is that, if a newer version of the +package is not installable but an older version is, we will now +fail where previously we did not. But even in that case I don't +know if we would *reliably* succeed before, and silently +installing an older version still doesn't necessarily seem like +the right thing to do. + +Signed-off-by: Adam Williamson +--- + service/realm-packages.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/service/realm-packages.c b/service/realm-packages.c +index 5976439..0309c57 100644 +--- a/service/realm-packages.c ++++ b/service/realm-packages.c +@@ -343,6 +343,7 @@ packages_resolve_async (GDBusConnection *connection, + gpointer user_data) + { + guint64 flags = 1 << 18 /* PK_FILTER_ENUM_ARCH */; ++ flags |= 1 << 16 /* PK_FILTER_ENUM_NEWEST */; + package_transaction_create ("Resolve", g_variant_new ("(t^as)", flags, package_names), + connection, cancellable, callback, user_data); + } +-- +2.20.1 + diff --git a/0001-tests-ignore-order-in-test_update_domain.patch b/0001-tests-ignore-order-in-test_update_domain.patch new file mode 100644 index 0000000..2a84aba --- /dev/null +++ b/0001-tests-ignore-order-in-test_update_domain.patch @@ -0,0 +1,82 @@ +From b6753bd048b4012b11d60c094d1ab6ca181ee50d Mon Sep 17 00:00:00 2001 +From: Sumit Bose +Date: Thu, 21 Feb 2019 21:16:26 +0100 +Subject: [PATCH] tests: ignore order in test_update_domain + +Individual options of a domain or in general for a section in an ini +file are stored by realmd in a hash table. When writing out the ini file +the options can show up in any order and the unit tests should be aware +of it. + +Resolves: https://gitlab.freedesktop.org/realmd/realmd/issues/19 +--- + tests/test-sssd-config.c | 41 ++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 39 insertions(+), 2 deletions(-) + +diff --git a/tests/test-sssd-config.c b/tests/test-sssd-config.c +index 59eab75..8f3fec5 100644 +--- a/tests/test-sssd-config.c ++++ b/tests/test-sssd-config.c +@@ -163,12 +163,49 @@ test_add_domain_only (Test *test, + g_free (output); + } + ++static void check_for_test_update_domain (char *new) ++{ ++ char *token; ++ char *saveptr; ++ size_t c; ++ int result = 0; ++ ++ token = strtok_r (new, "\n", &saveptr); ++ g_assert_nonnull (token); ++ g_assert_cmpstr (token, ==, "[domain/one]"); ++ ++ for (c = 0; c < 3; c++) { ++ token = strtok_r (NULL, "\n", &saveptr); ++ g_assert_nonnull (token); ++ if (strcmp (token, "val=1") == 0) { ++ result += 1; ++ } else if (strcmp (token, "uno = 1") == 0) { ++ result += 2; ++ } else if (strcmp (token, "eins = one") == 0) { ++ result += 4; ++ } else { ++ g_assert_not_reached (); ++ } ++ } ++ g_assert_cmpint (result, ==, 7); ++ ++ token = strtok_r (NULL, "\n", &saveptr); ++ g_assert_nonnull (token); ++ g_assert_cmpstr (token, ==, "[sssd]"); ++ ++ token = strtok_r (NULL, "\n", &saveptr); ++ g_assert_nonnull (token); ++ g_assert_cmpstr (token, ==, "domains=one"); ++ ++ token = strtok_r (NULL, "\n", &saveptr); ++ g_assert_null (token); ++} ++ + static void + test_update_domain (Test *test, + gconstpointer unused) + { + const gchar *data = "[domain/one]\nval=1\n[sssd]\ndomains=one"; +- const gchar *check = "[domain/one]\nval=1\nuno = 1\neins = one\n[sssd]\ndomains=one"; + GError *error = NULL; + gchar *output; + gboolean ret; +@@ -190,7 +227,7 @@ test_update_domain (Test *test, + g_assert_no_error (error); + g_assert (ret == TRUE); + +- g_assert_cmpstr (check, ==, output); ++ check_for_test_update_domain (output); + g_free (output); + } + +-- +2.20.1 + diff --git a/realmd.spec b/realmd.spec index 2c4c30a..f81a975 100644 --- a/realmd.spec +++ b/realmd.spec @@ -1,6 +1,6 @@ Name: realmd Version: 0.16.3 -Release: 16%{?dist} +Release: 19%{?dist} Summary: Kerberos realm enrollment service License: LGPLv2+ URL: http://cgit.freedesktop.org/realmd/realmd/ @@ -22,6 +22,11 @@ Patch12: 0003-discover-try-to-get-domain-name-from-hostname.patch Patch13: 0001-IPA-do-not-call-sssd-enable-logins.patch +Patch14: 0001-Set-NEWEST-flag-when-resolving-packages-with-Package.patch + +# Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1675879 +Patch15: 0001-tests-ignore-order-in-test_update_domain.patch + BuildRequires: gcc BuildRequires: automake BuildRequires: autoconf @@ -68,6 +73,8 @@ applications that use %{name}. %patch11 -p1 %patch12 -p1 %patch13 -p1 +%patch14 -p1 +%patch15 -p1 %build autoreconf -fi @@ -102,6 +109,16 @@ make install DESTDIR=%{buildroot} %doc ChangeLog %changelog +* Thu Feb 21 2019 Sumit Bose - 0.16.3-19 +- fix test depending on order + Resolves: rhbz#1675879 + +* Wed Feb 20 2019 Adam Williamson - 0.16.3-18 +- Backport fix from upstream to always install latest packages via PK + +* Sat Feb 02 2019 Fedora Release Engineering - 0.16.3-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Thu Sep 27 2018 Sumit Bose - 0.16.3-16 - Do not call authselect for IPA domains Resolves: rhbz#1620097