From 241e7cfce596101456e9cfcc21491da7afc28ef2 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jul 28 2020 10:24:59 +0000 Subject: import xdg-desktop-portal-gtk-1.6.0-1.el8 --- diff --git a/.gitignore b/.gitignore index 5af5fc8..859c212 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/xdg-desktop-portal-gtk-1.4.0.tar.xz +SOURCES/xdg-desktop-portal-gtk-1.6.0.tar.xz diff --git a/.xdg-desktop-portal-gtk.metadata b/.xdg-desktop-portal-gtk.metadata index 2dcd5dd..08195e6 100644 --- a/.xdg-desktop-portal-gtk.metadata +++ b/.xdg-desktop-portal-gtk.metadata @@ -1 +1 @@ -4eaac561a929cccef55149bf1b40418230e5af99 SOURCES/xdg-desktop-portal-gtk-1.4.0.tar.xz +def673d34fd81610aea81ae062a34d1fa64ffdc5 SOURCES/xdg-desktop-portal-gtk-1.6.0.tar.xz diff --git a/SOURCES/0001-appchooserdialog-avoid-crash-when-there-are-few-app-.patch b/SOURCES/0001-appchooserdialog-avoid-crash-when-there-are-few-app-.patch new file mode 100644 index 0000000..f698911 --- /dev/null +++ b/SOURCES/0001-appchooserdialog-avoid-crash-when-there-are-few-app-.patch @@ -0,0 +1,38 @@ +From 54ceb35d892ac33c59f4d255359d8184f1b72679 Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Fri, 1 May 2020 17:58:35 -0500 +Subject: [PATCH 1/4] appchooserdialog: avoid crash when there are few app + options + +Problem is the code reads off the end of the choices list when the +number of choices is less than INITIAL_LIST_SIZE - 1. + +Fixes #302 + +(cherry picked from commit 7d2b3e270b6a964d8007b5cbb5dfc52c3f9a23ce) +--- + src/appchooserdialog.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/appchooserdialog.c b/src/appchooserdialog.c +index 82e362e..0b9f31e 100644 +--- a/src/appchooserdialog.c ++++ b/src/appchooserdialog.c +@@ -384,11 +384,11 @@ app_chooser_dialog_new (const char **choices, + gtk_label_set_label (GTK_LABEL (dialog->heading), _("Choose an application.")); + } + +- ensure_default_is_below (choices, default_id, INITIAL_LIST_SIZE - 1); +- + dialog->choices = g_strdupv ((char **)choices); +- + n_choices = g_strv_length ((char **)choices); ++ ++ ensure_default_is_below (dialog->choices, default_id, MIN (n_choices, INITIAL_LIST_SIZE - 1)); ++ + if (n_choices == 0) + { + gtk_widget_show (dialog->empty_box); +-- +2.26.2 + diff --git a/SOURCES/0001-screencast-Bump-supported-Mutter-version-to-3-280.patch b/SOURCES/0001-screencast-Bump-supported-Mutter-version-to-3-280.patch new file mode 100644 index 0000000..361a7c8 --- /dev/null +++ b/SOURCES/0001-screencast-Bump-supported-Mutter-version-to-3-280.patch @@ -0,0 +1,46 @@ +From 4a280729ba87343d056360ed0be99e9e53ab44e9 Mon Sep 17 00:00:00 2001 +From: Georges Basile Stavracas Neto + +Date: Mon, 24 Feb 2020 17:20:19 -0300 +Subject: [PATCH] screencast: Bump supported Mutter version to 3 (#280) + +With the new Mutter version and the inclusion of pipewire 0.3 support +into Mutter, the reported D-Bus version for the screencast API was +bumped to 3. + +Update the supported version here as well. No code changes are necessary +to make it work with the version 3 of the API. +--- + src/gnomescreencast.c | 2 +- + src/screencast.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/gnomescreencast.c b/src/gnomescreencast.c +index 3ae5031..0df0f05 100644 +--- a/src/gnomescreencast.c ++++ b/src/gnomescreencast.c +@@ -22,7 +22,7 @@ + + #include + +-#define SUPPORTED_MUTTER_SCREEN_CAST_API_VERSION 2 ++#define SUPPORTED_MUTTER_SCREEN_CAST_API_VERSION 3 + + enum + { +diff --git a/src/screencast.c b/src/screencast.c +index 5418c23..c4c75a0 100644 +--- a/src/screencast.c ++++ b/src/screencast.c +@@ -35,7 +35,7 @@ + #include "session.h" + #include "utils.h" + +-#define SUPPORTED_MUTTER_SCREEN_CAST_API_VERSION 2 ++#define SUPPORTED_MUTTER_SCREEN_CAST_API_VERSION 3 + + typedef struct _ScreenCastDialogHandle ScreenCastDialogHandle; + +-- +2.26.2 + diff --git a/SOURCES/0002-appchooserdialog-improve-handling-of-INITIAL_LIST_SI.patch b/SOURCES/0002-appchooserdialog-improve-handling-of-INITIAL_LIST_SI.patch new file mode 100644 index 0000000..e7806e1 --- /dev/null +++ b/SOURCES/0002-appchooserdialog-improve-handling-of-INITIAL_LIST_SI.patch @@ -0,0 +1,61 @@ +From 86bd1b0055d32b8356011cde82b51296b9880588 Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Wed, 6 May 2020 10:43:13 -0500 +Subject: [PATCH 2/4] appchooserdialog: improve handling of INITIAL_LIST_SIZE + +Currently INITIAL_LIST_SIZE is one greater than the initial number of +desktop files presented, which is actually 3. I guess the "show more" +button is considered part of the initial list, in which case the size of +the list is indeed 4, but that's *really* confusing. Let's change this +so that it matches the number of desktop files presented initially. No +behavior changes. + +(cherry picked from commit 15c6cd88b1ba2f913bc00eb46a04b045e77349ad) +--- + src/appchooserdialog.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/src/appchooserdialog.c b/src/appchooserdialog.c +index 0b9f31e..b779f43 100644 +--- a/src/appchooserdialog.c ++++ b/src/appchooserdialog.c +@@ -32,7 +32,7 @@ + #include "appchooserrow.h" + + #define LOCATION_MAX_LENGTH 40 +-#define INITIAL_LIST_SIZE 4 ++#define INITIAL_LIST_SIZE 3 + + struct _AppChooserDialog { + GtkWindow parent; +@@ -132,7 +132,7 @@ show_more (AppChooserDialog *dialog) + gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); + gtk_widget_hide (dialog->more_row); + +- for (i = INITIAL_LIST_SIZE - 1; dialog->choices[i]; i++) ++ for (i = INITIAL_LIST_SIZE; dialog->choices[i]; i++) + { + g_autofree char *desktop_id = g_strconcat (dialog->choices[i], ".desktop", NULL); + g_autoptr(GAppInfo) info = G_APP_INFO (g_desktop_app_info_new (desktop_id)); +@@ -387,7 +387,7 @@ app_chooser_dialog_new (const char **choices, + dialog->choices = g_strdupv ((char **)choices); + n_choices = g_strv_length ((char **)choices); + +- ensure_default_is_below (dialog->choices, default_id, MIN (n_choices, INITIAL_LIST_SIZE - 1)); ++ ensure_default_is_below (dialog->choices, default_id, MIN (n_choices, INITIAL_LIST_SIZE)); + + if (n_choices == 0) + { +@@ -416,9 +416,6 @@ app_chooser_dialog_new (const char **choices, + g_autoptr(GAppInfo) info = G_APP_INFO (g_desktop_app_info_new (desktop_id)); + GtkWidget *row; + +- if (i == INITIAL_LIST_SIZE - 1 && n_choices > INITIAL_LIST_SIZE) +- break; +- + row = GTK_WIDGET (app_chooser_row_new (info)); + gtk_widget_set_visible (row, TRUE); + gtk_list_box_insert (GTK_LIST_BOX (dialog->list), row, -1); +-- +2.26.2 + diff --git a/SOURCES/0003-appchooserdialog-add-g_return-to-show_more.patch b/SOURCES/0003-appchooserdialog-add-g_return-to-show_more.patch new file mode 100644 index 0000000..091e7ff --- /dev/null +++ b/SOURCES/0003-appchooserdialog-add-g_return-to-show_more.patch @@ -0,0 +1,31 @@ +From 34db1404382cebbfbf170cfba53371d465c1668f Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Wed, 6 May 2020 10:57:29 -0500 +Subject: [PATCH 3/4] appchooserdialog: add g_return to show_more() + +We should never get here unless there are more desktop file choices than +the initial list size. We never do; this assertion is just here to +clarify this. (Otherwise, we could have a buffer overrun in the loop +below.) + +(cherry picked from commit 878c06a525b05315fe56baae59c19bfd714df638) +--- + src/appchooserdialog.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/appchooserdialog.c b/src/appchooserdialog.c +index b779f43..c0eb4ca 100644 +--- a/src/appchooserdialog.c ++++ b/src/appchooserdialog.c +@@ -132,6 +132,8 @@ show_more (AppChooserDialog *dialog) + gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); + gtk_widget_hide (dialog->more_row); + ++ g_return_if_fail (g_strv_length ((char **)dialog->choices) > INITIAL_LIST_SIZE); ++ + for (i = INITIAL_LIST_SIZE; dialog->choices[i]; i++) + { + g_autofree char *desktop_id = g_strconcat (dialog->choices[i], ".desktop", NULL); +-- +2.26.2 + diff --git a/SOURCES/0004-appchooserdialog-improve-safety-of-ensure_default-fu.patch b/SOURCES/0004-appchooserdialog-improve-safety-of-ensure_default-fu.patch new file mode 100644 index 0000000..b333961 --- /dev/null +++ b/SOURCES/0004-appchooserdialog-improve-safety-of-ensure_default-fu.patch @@ -0,0 +1,69 @@ +From 8f01a166ec2097f913f4e69379954a96a38d0d84 Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Wed, 6 May 2020 10:57:41 -0500 +Subject: [PATCH 4/4] appchooserdialog: improve safety of ensure_default + function + +We can calculate the bounds ourselves, instead of passing them in. This +way we don't need to rely on the caller to avoid buffer overflow. This +would have prevented #302. + +(cherry picked from commit 1f30f6c730cef5152e09ded897ec0d6e54e87820) +--- + src/appchooserdialog.c | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git a/src/appchooserdialog.c b/src/appchooserdialog.c +index c0eb4ca..eb7181a 100644 +--- a/src/appchooserdialog.c ++++ b/src/appchooserdialog.c +@@ -316,22 +316,26 @@ shorten_location (const char *location) + } + + static void +-ensure_default_is_below (const char **choices, +- const char *default_id, +- int num) ++ensure_default_in_initial_list (const char **choices, ++ const char *default_id) + { + int i; ++ guint n_choices; + + if (default_id == NULL) + return; + +- for (i = 0; i < num && choices[i]; i++) ++ n_choices = g_strv_length ((char **)choices); ++ if (n_choices <= INITIAL_LIST_SIZE) ++ return; ++ ++ for (i = 0; i < INITIAL_LIST_SIZE; i++) + { + if (strcmp (choices[i], default_id) == 0) + return; + } + +- for (i = num; choices[i]; i++) ++ for (i = INITIAL_LIST_SIZE; i < n_choices; i++) + { + if (strcmp (choices[i], default_id) == 0) + { +@@ -386,11 +390,11 @@ app_chooser_dialog_new (const char **choices, + gtk_label_set_label (GTK_LABEL (dialog->heading), _("Choose an application.")); + } + +- dialog->choices = g_strdupv ((char **)choices); +- n_choices = g_strv_length ((char **)choices); ++ ensure_default_in_initial_list (choices, default_id); + +- ensure_default_is_below (dialog->choices, default_id, MIN (n_choices, INITIAL_LIST_SIZE)); ++ dialog->choices = g_strdupv ((char **)choices); + ++ n_choices = g_strv_length ((char **)choices); + if (n_choices == 0) + { + gtk_widget_show (dialog->empty_box); +-- +2.26.2 + diff --git a/SPECS/xdg-desktop-portal-gtk.spec b/SPECS/xdg-desktop-portal-gtk.spec index 56428e7..b641554 100644 --- a/SPECS/xdg-desktop-portal-gtk.spec +++ b/SPECS/xdg-desktop-portal-gtk.spec @@ -1,7 +1,7 @@ %global xdg_desktop_portal_version 1.1.1 Name: xdg-desktop-portal-gtk -Version: 1.4.0 +Version: 1.6.0 Release: 1%{?dist} Summary: Backend implementation for xdg-desktop-portal using GTK+ @@ -9,13 +9,24 @@ License: LGPLv2+ URL: https://github.com/flatpak/%{name} Source0: https://github.com/flatpak/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz +# Bump supported mutter API version to the one including PipeWire 0.3 support. (#1837413) +Patch1: 0001-screencast-Bump-supported-Mutter-version-to-3-280.patch + +# https://github.com/flatpak/xdg-desktop-portal/issues/480 (#1837413) +Patch2: 0001-appchooserdialog-avoid-crash-when-there-are-few-app-.patch +Patch3: 0002-appchooserdialog-improve-handling-of-INITIAL_LIST_SI.patch +Patch4: 0003-appchooserdialog-add-g_return-to-show_more.patch +Patch5: 0004-appchooserdialog-improve-safety-of-ensure_default-fu.patch + BuildRequires: gcc BuildRequires: gettext BuildRequires: pkgconfig(gtk+-unix-print-3.0) BuildRequires: pkgconfig(xdg-desktop-portal) >= %{xdg_desktop_portal_version} +BuildRequires: gnome-desktop3-devel %{?systemd_requires} BuildRequires: systemd Requires: dbus +Requires: gnome-desktop3 Requires: xdg-desktop-portal >= %{xdg_desktop_portal_version} %if 0%{?fedora} # Use rich deps to pull in this package when flatpak and gtk3 are both installed @@ -29,7 +40,7 @@ org.gnome.SessionManager D-Bus interfaces. %prep -%setup -q +%autosetup -S git %build @@ -61,6 +72,11 @@ org.gnome.SessionManager D-Bus interfaces. %changelog +* Mon May 25 2020 Jonas Ã…dahl - 1.6.0-1 +- Rebase to 1.6.0 (#1837413) +- Bump supported Mutter screen cast API version (#1837413) +- Backport bugfix (#1837413) + * Sat Oct 26 2019 David King - 1.4.0-1 - Rebase to 1.4.0 (#1748335)