commit: 1b7d1b1ecbe76a30c9487c77f7ecad0084e7d832 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Sat Mar 15 19:01:00 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sat Mar 15 19:01:11 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b7d1b1e
media-video/wireplumber: backport crash fixes Signed-off-by: Sam James <sam <AT> gentoo.org> .../files/wireplumber-0.5.8-custom-lua-crash.patch | 72 +++++++++++ .../files/wireplumber-0.5.8-mem-leak.patch | 28 +++++ .../files/wireplumber-0.5.8-vaargs.patch | 50 ++++++++ .../wireplumber/wireplumber-0.5.8-r2.ebuild | 137 +++++++++++++++++++++ 4 files changed, 287 insertions(+) diff --git a/media-video/wireplumber/files/wireplumber-0.5.8-custom-lua-crash.patch b/media-video/wireplumber/files/wireplumber-0.5.8-custom-lua-crash.patch new file mode 100644 index 000000000000..92358ded7b0f --- /dev/null +++ b/media-video/wireplumber/files/wireplumber-0.5.8-custom-lua-crash.patch @@ -0,0 +1,72 @@ +https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/32d2abdf34c987df24ba3b073159ea4eee2edf73 + +From 32d2abdf34c987df24ba3b073159ea4eee2edf73 Mon Sep 17 00:00:00 2001 +From: George Kiagiadakis <[email protected]> +Date: Thu, 13 Feb 2025 16:06:29 +0200 +Subject: [PATCH] internal-comp-loader: generate a "provides" for components + that don't have one + +It is valid for components not to have a "provides" field, but it +prevents them from being able to have "before" and "after" dependencies. +With this patch, we generate a hidden "provides" field so that the +dependencies sorting algorithm can work without issues. + +Fixes: #771 +--- + lib/wp/private/internal-comp-loader.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/lib/wp/private/internal-comp-loader.c b/lib/wp/private/internal-comp-loader.c +index 45877eb7..842c6934 100644 +--- a/lib/wp/private/internal-comp-loader.c ++++ b/lib/wp/private/internal-comp-loader.c +@@ -28,7 +28,7 @@ struct _ComponentData + grefcount ref; + /* an identifier for this component that is understandable by the end user */ + gchar *printable_id; +- /* the provided feature name or NULL */ ++ /* the provided feature name */ + gchar *provides; + /* the original state of the feature (required / optional / disabled) */ + FeatureState state; +@@ -205,7 +205,7 @@ component_data_new_from_json (WpSpaJson * json, WpProperties * features, + comp->printable_id = g_strdup_printf ("%s [%s]", comp->provides, comp->type); + } + } else { +- comp->provides = NULL; ++ comp->provides = g_strdup_printf ("__anonymous_%p", comp); + comp->state = FEATURE_STATE_REQUIRED; + comp->printable_id = g_strdup_printf ("[%s: %s]", comp->type, comp->name); + } +@@ -328,7 +328,7 @@ wp_component_array_load_task_get_next_step (WpTransition * transition, guint ste + static gboolean + component_equals (const ComponentData * comp, const gchar * provides) + { +- return (comp->provides && g_str_equal (provides, comp->provides)); ++ return g_str_equal (provides, comp->provides); + } + + static inline gboolean +@@ -358,7 +358,7 @@ sort_components_before_after (WpComponentArrayLoadTask * self, GError ** error) + gchar *target_provides = g_ptr_array_index (comp->before, j); + for (guint k = 0; k < self->components->len; k++) { + ComponentData *target = g_ptr_array_index (self->components, k); +- if (target->provides && g_str_equal (target_provides, target->provides)) { ++ if (g_str_equal (target_provides, target->provides)) { + g_ptr_array_insert (target->after, -1, g_strdup (comp->provides)); + } + } +@@ -531,9 +531,8 @@ parse_components (WpComponentArrayLoadTask * self, GError ** error) + if (comp->state == FEATURE_STATE_REQUIRED) + g_ptr_array_add (required_components, component_data_ref (comp)); + +- if (comp->provides) +- g_hash_table_insert (self->feat_components, comp->provides, +- component_data_ref (comp)); ++ g_hash_table_insert (self->feat_components, comp->provides, ++ component_data_ref (comp)); + } + + /* topological sorting based on depth-first search */ +-- +GitLab diff --git a/media-video/wireplumber/files/wireplumber-0.5.8-mem-leak.patch b/media-video/wireplumber/files/wireplumber-0.5.8-mem-leak.patch new file mode 100644 index 000000000000..24d6c4c426d0 --- /dev/null +++ b/media-video/wireplumber/files/wireplumber-0.5.8-mem-leak.patch @@ -0,0 +1,28 @@ +https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/f3bc7168edeac015154feda01698a9c10f68e1b1 + +From f3bc7168edeac015154feda01698a9c10f68e1b1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= <[email protected]> +Date: Wed, 19 Feb 2025 18:34:58 +0100 +Subject: [PATCH] wpctl: fix default device name leak + +The `get-default-configured-node-name` handler returns a copy +of the name of the node, hence it must be freed. +--- + src/tools/wpctl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/tools/wpctl.c b/src/tools/wpctl.c +index 9f507eca..38d730c8 100644 +--- a/src/tools/wpctl.c ++++ b/src/tools/wpctl.c +@@ -529,7 +529,7 @@ status_run (WpCtl * self) + printf (TREE_INDENT_END "Default Configured Devices:\n"); + if (def_nodes_api) { + for (guint i = 0; i < G_N_ELEMENTS (DEFAULT_NODE_MEDIA_CLASSES); i++) { +- const gchar *name = NULL; ++ g_autofree gchar *name = NULL; + g_signal_emit_by_name (def_nodes_api, "get-default-configured-node-name", + DEFAULT_NODE_MEDIA_CLASSES[i], &name); + if (name) +-- +GitLab diff --git a/media-video/wireplumber/files/wireplumber-0.5.8-vaargs.patch b/media-video/wireplumber/files/wireplumber-0.5.8-vaargs.patch new file mode 100644 index 000000000000..c047ecf7c026 --- /dev/null +++ b/media-video/wireplumber/files/wireplumber-0.5.8-vaargs.patch @@ -0,0 +1,50 @@ +https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/5846d12ea156c961772a44163a42987ef35c1ab6 + +From 5846d12ea156c961772a44163a42987ef35c1ab6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= <[email protected]> +Date: Tue, 18 Feb 2025 19:57:22 +0100 +Subject: [PATCH] wpctl: fix types in variadic arguments + +`wp_object_manager_add_interest()` passes the format string +and the arguments after that to `g_variant_new()`, which +requires a 32-bit integer for "u". Passing a 64-bit integer +will cause problems on certain ABIs. + +Furthermore, remove the metadata related interest declaration +from `set_default_prepare()` since the "set-default" command +does not access metadata directly, it uses the "default-nodes-api" +plugin. + +Fixes: 7784cfad92cfa4 ("wpctl: support @DEFAULT_{AUDIO,VIDEO}_{SINK,SOURCE}@ as ID ") +Fixes #773 +--- + src/tools/wpctl.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/src/tools/wpctl.c b/src/tools/wpctl.c +index 38d730c8..0e671109 100644 +--- a/src/tools/wpctl.c ++++ b/src/tools/wpctl.c +@@ -753,7 +753,7 @@ inspect_print_object (WpCtl * self, WpProxy * proxy, guint nest_level) + if (cmdline.inspect.show_referenced && nest_level == 0 && + key_is_object_reference (prop_item->key)) + { +- guint id = (guint) strtol (prop_item->value, NULL, 10); ++ guint32 id = (guint32) strtol (prop_item->value, NULL, 10); + g_autoptr (WpProxy) refer_proxy = + wp_object_manager_lookup (self->om, WP_TYPE_GLOBAL_PROXY, + WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, NULL); +@@ -833,10 +833,8 @@ set_default_prepare (WpCtl * self, GError ** error) + { + wp_object_manager_add_interest (self->om, WP_TYPE_NODE, + WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY, +- "object.id", "=u", cmdline.set_default.id, ++ "object.id", "=u", (guint32) cmdline.set_default.id, + NULL); +- wp_object_manager_request_object_features (self->om, WP_TYPE_METADATA, +- WP_OBJECT_FEATURES_ALL); + wp_object_manager_request_object_features (self->om, WP_TYPE_NODE, + WP_PIPEWIRE_OBJECT_FEATURES_MINIMAL); + return TRUE; +-- +GitLab diff --git a/media-video/wireplumber/wireplumber-0.5.8-r2.ebuild b/media-video/wireplumber/wireplumber-0.5.8-r2.ebuild new file mode 100644 index 000000000000..6647fd71c2e6 --- /dev/null +++ b/media-video/wireplumber/wireplumber-0.5.8-r2.ebuild @@ -0,0 +1,137 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +# 1. Please regularly check (even at the point of bumping) Fedora's packaging +# for needed backports at https://src.fedoraproject.org/rpms/wireplumber/tree/rawhide +# +# 2. Keep an eye on git master (for both PipeWire and WirePlumber) as things +# continue to move quickly. It's not uncommon for fixes to be made shortly +# after releases. + +LUA_COMPAT=( lua5-{3,4} ) + +inherit lua-single meson systemd + +DESCRIPTION="Replacement for pipewire-media-session" +HOMEPAGE="https://gitlab.freedesktop.org/pipewire/wireplumber" + +if [[ ${PV} == 9999 ]]; then + EGIT_REPO_URI="https://gitlab.freedesktop.org/pipewire/${PN}.git" + EGIT_BRANCH="master" + inherit git-r3 +else + SRC_URI="https://gitlab.freedesktop.org/pipewire/${PN}/-/archive/${PV}/${P}.tar.bz2" + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" +fi + +LICENSE="MIT" +SLOT="0/0.5" +IUSE="elogind system-service systemd test" + +REQUIRED_USE=" + ${LUA_REQUIRED_USE} + ?? ( elogind systemd ) + system-service? ( systemd ) +" + +RESTRICT="!test? ( test )" + +# introspection? ( dev-libs/gobject-introspection ) is valid but likely only used for doc building +BDEPEND=" + dev-libs/glib + dev-util/gdbus-codegen + dev-util/glib-utils + sys-devel/gettext + test? ( sys-apps/dbus ) +" +DEPEND=" + ${LUA_DEPS} + >=dev-libs/glib-2.68 + >=media-video/pipewire-1.0.5-r1:= + virtual/libintl + elogind? ( sys-auth/elogind ) + systemd? ( sys-apps/systemd ) +" +RDEPEND=" + ${DEPEND} + system-service? ( + acct-user/pipewire + acct-group/pipewire + ) +" + +DOCS=( {NEWS,README}.rst ) + +PATCHES=( + # Defer enabling sound server parts to media-video/pipewire + # TODO: Soon, we should be able to migrate to just a dropin at + # /usr/share. See https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/652#note_2399735. + "${FILESDIR}"/${PN}-0.5.6-config-disable-sound-server-parts.patch + # Backports + "${FILESDIR}"/${P}-custom-lua-crash.patch + "${FILESDIR}"/${P}-mem-leak.patch + "${FILESDIR}"/${P}-vaargs.patch +) + +src_configure() { + local emesonargs=( + -Ddaemon=true + -Dtools=true + -Dmodules=true + # Ebuild not wired up yet (Sphinx, Doxygen?) + -Ddoc=disabled + # Only used for Sphinx doc generation + -Dintrospection=disabled + -Dsystem-lua=true + -Dsystem-lua-version=$(ver_cut 1-2 $(lua_get_version)) + $(meson_feature elogind) + $(meson_feature systemd) + $(meson_use system-service systemd-system-service) + $(meson_use systemd systemd-user-service) + -Dsystemd-system-unit-dir=$(systemd_get_systemunitdir) + -Dsystemd-user-unit-dir=$(systemd_get_userunitdir) + $(meson_use test tests) + $(meson_use test dbus-tests) + ) + + meson_src_configure +} + +src_install() { + meson_src_install + + exeinto /etc/user/init.d + newexe "${FILESDIR}"/wireplumber.initd wireplumber + + mv "${ED}"/usr/share/doc/wireplumber/* "${ED}"/usr/share/doc/${PF} || die + rmdir "${ED}"/usr/share/doc/wireplumber || die +} + +pkg_postinst() { + if systemd_is_booted ; then + ewarn "pipewire-media-session.service is no longer installed. You must switch" + ewarn "to wireplumber.service user unit before your next logout/reboot:" + ewarn "systemctl --user disable pipewire-media-session.service" + ewarn "systemctl --user --force enable wireplumber.service" + else + ewarn "Switch to WirePlumber will happen the next time gentoo-pipewire-launcher" + ewarn "is started (a replacement for directly calling pipewire binary)." + ewarn + ewarn "Please ensure that ${EROOT}/etc/pipewire/pipewire.conf either does not exist" + ewarn "or, if it does exist, that any reference to" + ewarn "${EROOT}/usr/bin/pipewire-media-session is commented out (begins with a #)." + fi + + if use system-service; then + ewarn + ewarn "WARNING: you have enabled the system-service USE flag, which installs" + ewarn "the system-wide systemd units that enable WirePlumber to run as a system" + ewarn "service. This is more than likely NOT what you want. You are strongly" + ewarn "advised not to enable this mode and instead stick with systemd user" + ewarn "units. The default configuration files will likely not work out of" + ewarn "box, and you are on your own with configuration." + ewarn + fi +}
