From 00f050ca50ed263883650e2f5819556bec57e678 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Thu, 28 Jan 2021 14:26:06 +0100 Subject: [PATCH 1/3] Make provides/requires filtering smarter/automatic The issue with the previous approach was that _everything_ that firefox's shared libraries required was filtered out. This included e.g. libxul.so's dependency on libdbus-glib-1.so.2 which definitely should not be filtered out. Instead, a better approach is to only filter out all of the private libraries provides (as they are firefox's implementation detail) and also all the internal requires on the same private libraries. RPM doesn't make it very easy, but the rudimentary filtering is there and we can build upon that. This commit improves the filtering by making it actually look at what's built, and automatically generating the list of private libraries to filter based on that. This also lets us drop manual dbus-glib requires and instead rely on rpm's automatic dep generator (the results are no longer filtered out). This should make the filtering future proof when more private libraries are added in the future (e.g. nss). https://bugzilla.redhat.com/show_bug.cgi?id=1582116 --- firefox.spec | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/firefox.spec b/firefox.spec index d03c7ca..7bbb235 100644 --- a/firefox.spec +++ b/firefox.spec @@ -145,10 +145,14 @@ ExcludeArch: s390x %global pre_tag .debug %endif +# Exclude private libraries from autogenerated provides and requires +%global __provides_exclude_from ^%{mozappdir} +%global __requires_exclude ^(%%(find %{buildroot}%{mozappdir} -name '*.so' | xargs -n1 basename | sort -u | paste -s -d '|' -)) + Summary: Mozilla Firefox Web browser Name: firefox Version: 85.0 -Release: 5%{?pre_tag}%{?dist} +Release: 6%{?pre_tag}%{?dist} URL: https://www.mozilla.org/firefox/ License: MPLv1.1 or GPLv2+ or LGPLv2+ Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz @@ -287,7 +291,6 @@ Requires: mozilla-filesystem Recommends: mozilla-openh264 >= 2.1.1 Recommends: libva Requires: p11-kit-trust -Requires: dbus-glib %if %{?system_nss} Requires: nspr >= %{nspr_build_version} Requires: nss >= %{nss_build_version} @@ -716,19 +719,6 @@ xvfb-run ./mach build 2>&1 | cat - make -C objdir buildsymbols %endif -# Don't provide/require bundled libs -%filter_provides_in %{mozappdir}/ -%filter_requires_in %{mozappdir}/ -%filter_provides_in %{mozappdir}/gmp-clearkey/0.1/ -%filter_requires_in %{mozappdir}/gmp-clearkey/0.1/ -%filter_provides_in %{mozappdir}/gtk2 -%filter_requires_in %{mozappdir}/gtk2 -# Do not check .so files in an application-specific library directory -# or any files in the application's data directory for provides -%global __requires_exclude_from ^(%{_libdir}/%{name}/.*\\.so.*|%{_libdir}/%{name}/gmp-clearkey/0.1/.*\\.so.*|%{_libdir}/%{name}/gtk2/.*\\.so.*)$ -%global __provides_exclude_from ^(%{_libdir}/%{name}/.*\\.so.*|%{_libdir}/%{name}/gmp-clearkey/0.1/.*\\.so.*|%{_libdir}/%{name}/gtk2/.*\\.so.*)$ -%global __requires_exclude ^libxul.*$ - # run Firefox test suite %if 0%{?run_firefox_tests} mkdir -p objdir/_virtualenvs/init_py3 @@ -1020,6 +1010,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Thu Jan 28 2021 Kalev Lember - 85.0-6 +- Make provides/requires filtering smarter/automatic (rhbz#1582116) +- Drop dbus-glib requires that are now automatically generated again + * Thu Jan 28 2021 Martin Stransky - 85.0-5 - Add dbus-glib requires. From cee1091026bfdfae59e882462c3deee1c2860896 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Sat, 30 Jan 2021 14:55:47 +0100 Subject: [PATCH 2/3] Added clipboard fix mozbz#1631061. --- mozilla-1631061.patch | 158 ------------------------------------------ 1 file changed, 158 deletions(-) delete mode 100644 mozilla-1631061.patch diff --git a/mozilla-1631061.patch b/mozilla-1631061.patch deleted file mode 100644 index acd1c5a..0000000 --- a/mozilla-1631061.patch +++ /dev/null @@ -1,158 +0,0 @@ -changeset: 563258:ed4b271af277 -tag: tip -parent: 563255:2c9db4cd3d89 -user: stransky -date: Tue Dec 22 11:03:28 2020 +0100 -files: widget/gtk/nsClipboardWayland.cpp widget/gtk/nsClipboardWayland.h -description: -Bug 1631061 [Wayland] Remove fast track clipboard and always ask compositor for clipboard data, r?rmader - -Differential Revision: https://phabricator.services.mozilla.com/D100317 - - -diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp ---- a/widget/gtk/nsClipboardWayland.cpp -+++ b/widget/gtk/nsClipboardWayland.cpp -@@ -749,7 +749,6 @@ nsRetrievalContextWayland::nsRetrievalCo - mClipboardOffer(nullptr), - mPrimaryOffer(nullptr), - mDragContext(nullptr), -- mClipboardRequestNumber(0), - mClipboardData(nullptr), - mClipboardDataLength(0) { - wl_data_device* dataDevice = wl_data_device_manager_get_data_device( -@@ -807,42 +806,6 @@ GdkAtom* nsRetrievalContextWayland::GetT - return nullptr; - } - --struct FastTrackClipboard { -- FastTrackClipboard(int aClipboardRequestNumber, -- nsRetrievalContextWayland* aRetrievalContex) -- : mClipboardRequestNumber(aClipboardRequestNumber), -- mRetrievalContex(aRetrievalContex) {} -- -- int mClipboardRequestNumber; -- nsRetrievalContextWayland* mRetrievalContex; --}; -- --static void wayland_clipboard_contents_received( -- GtkClipboard* clipboard, GtkSelectionData* selection_data, gpointer data) { -- LOGCLIP(("wayland_clipboard_contents_received() callback\n")); -- FastTrackClipboard* fastTrack = static_cast(data); -- fastTrack->mRetrievalContex->TransferFastTrackClipboard( -- fastTrack->mClipboardRequestNumber, selection_data); -- delete fastTrack; --} -- --void nsRetrievalContextWayland::TransferFastTrackClipboard( -- int aClipboardRequestNumber, GtkSelectionData* aSelectionData) { -- if (mClipboardRequestNumber == aClipboardRequestNumber) { -- int dataLength = gtk_selection_data_get_length(aSelectionData); -- if (dataLength > 0) { -- mClipboardDataLength = dataLength; -- mClipboardData = reinterpret_cast( -- g_malloc(sizeof(char) * (mClipboardDataLength + 1))); -- memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData), -- sizeof(char) * mClipboardDataLength); -- mClipboardData[mClipboardDataLength] = '\0'; -- } -- } else { -- NS_WARNING("Received obsoleted clipboard data!"); -- } --} -- - const char* nsRetrievalContextWayland::GetClipboardData( - const char* aMimeType, int32_t aWhichClipboard, uint32_t* aContentLength) { - NS_ASSERTION(mClipboardData == nullptr && mClipboardDataLength == 0, -@@ -851,33 +814,20 @@ const char* nsRetrievalContextWayland::G - LOGCLIP(("nsRetrievalContextWayland::GetClipboardData [%p] mime %s\n", this, - aMimeType)); - -- /* If actual clipboard data is owned by us we don't need to go -- * through Wayland but we ask Gtk+ to directly call data -- * getter callback nsClipboard::SelectionGetEvent(). -- * see gtk_selection_convert() at gtk+/gtkselection.c. -- */ -- GdkAtom selection = GetSelectionAtom(aWhichClipboard); -- if (gdk_selection_owner_get(selection)) { -- LOGCLIP((" Internal clipboard content\n")); -- mClipboardRequestNumber++; -- gtk_clipboard_request_contents( -- gtk_clipboard_get(selection), gdk_atom_intern(aMimeType, FALSE), -- wayland_clipboard_contents_received, -- new FastTrackClipboard(mClipboardRequestNumber, this)); -+ const auto& dataOffer = -+ (GetSelectionAtom(aWhichClipboard) == GDK_SELECTION_PRIMARY) -+ ? mPrimaryOffer -+ : mClipboardOffer; -+ if (!dataOffer) { -+ // Something went wrong. We're requested to provide clipboard data -+ // but we haven't got any from wayland. -+ NS_WARNING("Requested data without valid DataOffer!"); -+ if (mClipboardData) { -+ ReleaseClipboardData(mClipboardData); -+ } - } else { -- LOGCLIP((" Remote clipboard content\n")); -- const auto& dataOffer = -- (selection == GDK_SELECTION_PRIMARY) ? mPrimaryOffer : mClipboardOffer; -- if (!dataOffer) { -- // Something went wrong. We're requested to provide clipboard data -- // but we haven't got any from wayland. -- NS_WARNING("Requested data without valid DataOffer!"); -- mClipboardData = nullptr; -- mClipboardDataLength = 0; -- } else { -- mClipboardData = dataOffer->GetData(mDisplay->GetDisplay(), aMimeType, -- &mClipboardDataLength); -- } -+ mClipboardData = dataOffer->GetData(mDisplay->GetDisplay(), aMimeType, -+ &mClipboardDataLength); - } - - *aContentLength = mClipboardDataLength; -@@ -908,8 +858,10 @@ void nsRetrievalContextWayland::ReleaseC - - NS_ASSERTION(aClipboardData == mClipboardData, - "Releasing unknown clipboard data!"); -- g_free((void*)aClipboardData); - -- mClipboardData = nullptr; -- mClipboardDataLength = 0; -+ if (mClipboardData) { -+ g_free((void*)aClipboardData); -+ mClipboardData = nullptr; -+ mClipboardDataLength = 0; -+ } - } -diff --git a/widget/gtk/nsClipboardWayland.h b/widget/gtk/nsClipboardWayland.h ---- a/widget/gtk/nsClipboardWayland.h -+++ b/widget/gtk/nsClipboardWayland.h -@@ -16,8 +16,6 @@ - #include "nsClipboard.h" - #include "nsWaylandDisplay.h" - --struct FastTrackClipboard; -- - class DataOffer { - public: - void AddMIMEType(const char* aMimeType); -@@ -134,9 +132,6 @@ class nsRetrievalContextWayland : public - - void ClearDragAndDropDataOffer(); - -- void TransferFastTrackClipboard(int aClipboardRequestNumber, -- GtkSelectionData* aSelectionData); -- - virtual ~nsRetrievalContextWayland() override; - - private: -@@ -149,7 +144,6 @@ class nsRetrievalContextWayland : public - mozilla::UniquePtr mPrimaryOffer; - RefPtr mDragContext; - -- int mClipboardRequestNumber; - char* mClipboardData; - uint32_t mClipboardDataLength; - - From 490f23e1ddd825c1e11c66a1d8546a589b0a3011 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Sat, 30 Jan 2021 14:56:07 +0100 Subject: [PATCH 3/3] Added clipboard fix mozbz#1631061. --- firefox.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/firefox.spec b/firefox.spec index d03c7ca..7d71233 100644 --- a/firefox.spec +++ b/firefox.spec @@ -221,12 +221,13 @@ Patch407: mozilla-1667096.patch Patch408: mozilla-1663844.patch Patch415: mozilla-1670333.patch Patch418: mozilla-1556931-s390x-hidden-syms.patch -Patch422: mozilla-1631061.patch Patch423: mozilla-1681107.patch Patch424: firefox-wayland-fix-mzbz-1642949-regression.patch Patch426: mozilla-1687931.patch Patch427: mozilla-1678247.patch Patch428: mozilla-1679933.patch +Patch429: mozilla-1631061-1.patch +Patch430: mozilla-1631061-2.patch # PGO/LTO patches Patch600: pgo.patch @@ -439,6 +440,8 @@ This package contains results of tests executed during build. %patch426 -p1 -b .1687931 %patch427 -p1 -b .1678247 %patch428 -p1 -b .1679933 +%patch429 -p1 -b .1631061 +%patch430 -p1 -b .1631061 # PGO patches %if %{build_with_pgo} @@ -1020,6 +1023,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Thu Jan 28 2021 Martin Stransky - 85.0-7 +- Added clipboard fix mozbz#1631061. + * Thu Jan 28 2021 Martin Stransky - 85.0-5 - Add dbus-glib requires.