Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package wireplumber for openSUSE:Factory checked in at 2023-01-14 00:02:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/wireplumber (Old) and /work/SRC/openSUSE:Factory/.wireplumber.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "wireplumber" Sat Jan 14 00:02:09 2023 rev:21 rq:1058203 version:0.4.13 Changes: -------- --- /work/SRC/openSUSE:Factory/wireplumber/wireplumber.changes 2022-12-14 14:11:10.935550031 +0100 +++ /work/SRC/openSUSE:Factory/.wireplumber.new.32243/wireplumber.changes 2023-01-14 00:02:11.393351677 +0100 @@ -1,0 +2,21 @@ +Fri Jan 13 10:51:07 UTC 2023 - Antonio Larrosa <alarr...@suse.com> + +- Backport the workaround from SLE/Leap for the bug in systemd + scripts that didn't set the default enable state for the + wireplumber user service when installing wireplumber. The bug + (boo#1200485) was fixed but that's only for new installations + while this workaround will fix old installations (boo#1202008). + This is used to automatically fix installations of + SLE 15 SP4/Leap 15.4 that were not updated during it's lifetime + and upgrade directly to SP5/15.5 . + +------------------------------------------------------------------- +Wed Jan 11 12:41:28 UTC 2023 - Antonio Larrosa <alarr...@suse.com> + +- Add upstream patches to fix glfo#pipewire/pipewire#2214 and to + handle better non-null terminated strings: + * 0001-alsa-monitor-handle-snd_aloop-devices-better.patch + * 0001-spa-json-make-sure-we-only-add-encoded-string-data.patch + * 0001-m-lua-scripting-ignore-string-integer-table-keys-when-constructing-a-JSON-Array-Object.patch + +------------------------------------------------------------------- New: ---- 0001-alsa-monitor-handle-snd_aloop-devices-better.patch 0001-m-lua-scripting-ignore-string-integer-table-keys-when-constructing-a-JSON-Array-Object.patch 0001-spa-json-make-sure-we-only-add-encoded-string-data.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ wireplumber.spec ++++++ --- /var/tmp/diff_new_pack.qwmpVE/_old 2023-01-14 00:02:13.245362465 +0100 +++ /var/tmp/diff_new_pack.qwmpVE/_new 2023-01-14 00:02:13.249362488 +0100 @@ -32,6 +32,13 @@ Source1: split-config-file.py # PATCH-FIX-OPENSUSE reduce-meson-required-version.patch Patch0: reduce-meson-required-version.patch +# PATCH-FIX-UPSTREAM 0001-alsa-monitor-handle-snd_aloop-devices-better.patch +Patch1: 0001-alsa-monitor-handle-snd_aloop-devices-better.patch +# PATCH-FIX-UPSTREAM 0001-spa-json-make-sure-we-only-add-encoded-string-data.patch +Patch2: 0001-spa-json-make-sure-we-only-add-encoded-string-data.patch +# PATCH-FIX-UPSTREAM 0001-m-lua-scripting-ignore-string-integer-table-keys-when-constructing-a-JSON-Array-Object.patch +Patch3: 0001-m-lua-scripting-ignore-string-integer-table-keys-when-constructing-a-JSON-Array-Object.patch + # docs BuildRequires: doxygen BuildRequires: graphviz @@ -70,6 +77,8 @@ %else BuildRequires: gcc-c++ %endif +%{?systemd_ordering} + %description WirePlumber is a modular session / policy manager for PipeWire and @@ -140,6 +149,9 @@ %if 0%{?suse_version} <= 1500 && 0%{?sle_version} <= 150300 %patch0 -p1 %endif +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 pushd src/config/main.lua.d python3 %{SOURCE1} @@ -172,6 +184,29 @@ %post %systemd_user_post wireplumber.service +%if 0%{?suse_version} <= 1500 +# If the pipewire.socket user unit is not enabled and the workaround +# for boo#1186561 has never been executed, we need to execute it now +if [ ! -L %{_sysconfdir}/systemd/user/pipewire.service.wants/wireplumber.service \ + -a ! -f %{_localstatedir}/lib/pipewire/wireplumber_post_workaround \ + -a -x %{_bindir}/systemctl ]; then + for service in wireplumber.service ; do + %{_bindir}/systemctl --global preset "$service" || : + done + + mkdir -p %{_localstatedir}/lib/pipewire + cat << EOF > %{_localstatedir}/lib/pipewire/wireplumber_post_workaround +# The existence of this file means that the wireplumber user services were +# enabled at least once. Please don't remove this file as that would +# make the services to be enabled again in the next package update. +# +# Check the following bugs for more information: +# https://bugzilla.opensuse.org/show_bug.cgi?id=1200485 +EOF +fi +%endif + + %preun %systemd_user_preun wireplumber.service ++++++ 0001-alsa-monitor-handle-snd_aloop-devices-better.patch ++++++ >From f6dc1b3347967948cf876c62fa597b803052cb3b Mon Sep 17 00:00:00 2001 From: Wim Taymans <wtaym...@redhat.com> Date: Tue, 13 Dec 2022 15:19:06 +0100 Subject: [PATCH] alsa-monitor: handle snd_aloop devices better Place Loopback as the device description for snd_aloop devices. Fixes pipewire#2214 --- src/scripts/monitors/alsa.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/scripts/monitors/alsa.lua b/src/scripts/monitors/alsa.lua index 195c0916..b959a4a2 100644 --- a/src/scripts/monitors/alsa.lua +++ b/src/scripts/monitors/alsa.lua @@ -228,8 +228,11 @@ function prepareDevice(parent, id, obj_type, factory, properties) local d = nil local f = properties["device.form-factor"] local c = properties["device.class"] + local n = properties["api.alsa.card.name"] - if f == "internal" then + if n == "Loopback" then + d = I18n.gettext("Loopback") + elseif f == "internal" then d = I18n.gettext("Built-in Audio") elseif c == "modem" then d = I18n.gettext("Modem") -- GitLab ++++++ 0001-m-lua-scripting-ignore-string-integer-table-keys-when-constructing-a-JSON-Array-Object.patch ++++++ >From 6b761c03e18b89c5121e4f48ce7df471504801fd Mon Sep 17 00:00:00 2001 From: Julian Bouzas <julian.bou...@collabora.com> Date: Wed, 4 Jan 2023 11:20:14 -0500 Subject: [PATCH] m-lua-scripting: ignore string/integer table keys when constructing a JSON Array/Object --- modules/module-lua-scripting/api/json.c | 97 +++++++++++++------------ tests/wplua/scripts/json.lua | 26 +++++++ 2 files changed, 77 insertions(+), 46 deletions(-) diff --git a/modules/module-lua-scripting/api/json.c b/modules/module-lua-scripting/api/json.c index be12ea38..cae96af8 100644 --- a/modules/module-lua-scripting/api/json.c +++ b/modules/module-lua-scripting/api/json.c @@ -242,31 +242,33 @@ spa_json_array_new (lua_State *L) luaL_checktype (L, 1, LUA_TTABLE); lua_pushnil (L); - while (lua_next (L, 1)) { - switch (lua_type (L, -1)) { - case LUA_TBOOLEAN: - wp_spa_json_builder_add_boolean (builder, lua_toboolean (L, -1)); - break; - case LUA_TNUMBER: - if (lua_isinteger (L, -1)) - wp_spa_json_builder_add_int (builder, lua_tointeger (L, -1)); - else - wp_spa_json_builder_add_float (builder, lua_tonumber (L, -1)); - break; - case LUA_TSTRING: - wp_spa_json_builder_add_string (builder, lua_tostring (L, -1)); - break; - case LUA_TUSERDATA: { - WpSpaJson *json = wplua_checkboxed (L, -1, WP_TYPE_SPA_JSON); - wp_spa_json_builder_add_json (builder, json); - break; + while (lua_next (L, -2)) { + /* We only add table values with integer keys */ + if (lua_isinteger (L, -2)) { + switch (lua_type (L, -1)) { + case LUA_TBOOLEAN: + wp_spa_json_builder_add_boolean (builder, lua_toboolean (L, -1)); + break; + case LUA_TNUMBER: + if (lua_isinteger (L, -1)) + wp_spa_json_builder_add_int (builder, lua_tointeger (L, -1)); + else + wp_spa_json_builder_add_float (builder, lua_tonumber (L, -1)); + break; + case LUA_TSTRING: + wp_spa_json_builder_add_string (builder, lua_tostring (L, -1)); + break; + case LUA_TUSERDATA: { + WpSpaJson *json = wplua_checkboxed (L, -1, WP_TYPE_SPA_JSON); + wp_spa_json_builder_add_json (builder, json); + break; + } + default: + luaL_error (L, "Json does not support lua type ", + lua_typename(L, lua_type(L, -1))); + break; } - default: - luaL_error (L, "Json does not support lua type ", - lua_typename(L, lua_type(L, -1))); - break; } - lua_pop (L, 1); } @@ -285,30 +287,33 @@ spa_json_object_new (lua_State *L) lua_pushnil (L); while (lua_next (L, -2)) { - wp_spa_json_builder_add_property (builder, lua_tostring (L, -2)); - - switch (lua_type (L, -1)) { - case LUA_TBOOLEAN: - wp_spa_json_builder_add_boolean (builder, lua_toboolean (L, -1)); - break; - case LUA_TNUMBER: - if (lua_isinteger (L, -1)) - wp_spa_json_builder_add_int (builder, lua_tointeger (L, -1)); - else - wp_spa_json_builder_add_float (builder, lua_tonumber (L, -1)); - break; - case LUA_TSTRING: - wp_spa_json_builder_add_string (builder, lua_tostring (L, -1)); - break; - case LUA_TUSERDATA: { - WpSpaJson *json = wplua_checkboxed (L, -1, WP_TYPE_SPA_JSON); - wp_spa_json_builder_add_json (builder, json); - break; + /* We only add table values with string keys */ + if (lua_type (L, -2) == LUA_TSTRING) { + wp_spa_json_builder_add_property (builder, lua_tostring (L, -2)); + + switch (lua_type (L, -1)) { + case LUA_TBOOLEAN: + wp_spa_json_builder_add_boolean (builder, lua_toboolean (L, -1)); + break; + case LUA_TNUMBER: + if (lua_isinteger (L, -1)) + wp_spa_json_builder_add_int (builder, lua_tointeger (L, -1)); + else + wp_spa_json_builder_add_float (builder, lua_tonumber (L, -1)); + break; + case LUA_TSTRING: + wp_spa_json_builder_add_string (builder, lua_tostring (L, -1)); + break; + case LUA_TUSERDATA: { + WpSpaJson *json = wplua_checkboxed (L, -1, WP_TYPE_SPA_JSON); + wp_spa_json_builder_add_json (builder, json); + break; + } + default: + luaL_error (L, "Json does not support lua type ", + lua_typename(L, lua_type(L, -1))); + break; } - default: - luaL_error (L, "Json does not support lua type ", - lua_typename(L, lua_type(L, -1))); - break; } lua_pop (L, 1); diff --git a/tests/wplua/scripts/json.lua b/tests/wplua/scripts/json.lua index e01d7f6f..3671a698 100644 --- a/tests/wplua/scripts/json.lua +++ b/tests/wplua/scripts/json.lua @@ -102,6 +102,19 @@ assert (json:is_array()) assert (json:get_data() == "[[{\"key1\":1}, {\"key2\":2}]]") assert (json:get_data() == json:to_string()) +table = {} +table[1] = 1 +table[2] = 2 +table[3] = 3 +table["4"] = 4 +json = Json.Array (table) +assert (json:is_array()) +val = json:parse () +assert (val[1] == 1) +assert (val[2] == 2) +assert (val[3] == 3) +assert (val["4"] == nil) + -- Object json = Json.Object { key1 = Json.Null(), @@ -134,6 +147,19 @@ assert (val.key7.key_nested3[2]) assert (not val.key7.key_nested3[3]) assert (val.key7["Key with spaces and (special % characters)"] == 50.0) +table = {} +table["1"] = 1 +table["2"] = 2 +table["3"] = 3 +table[4] = 4 +json = Json.Object (table) +assert (json:is_object()) +val = json:parse () +assert (val["1"] == 1) +assert (val["2"] == 2) +assert (val["3"] == 3) +assert (val[4] == nil) + -- Raw json = Json.Raw ("[\"foo\", \"bar\"]") assert (json:is_array()) -- GitLab ++++++ 0001-spa-json-make-sure-we-only-add-encoded-string-data.patch ++++++ >From 10f85549a42cd33daaa7a0c4eb1329c5f8067b7d Mon Sep 17 00:00:00 2001 From: Julian Bouzas <julian.bou...@collabora.com> Date: Wed, 4 Jan 2023 10:07:36 -0500 Subject: [PATCH] spa-json: make sure we only add encoded string data The spa_json_encode_string() API does not add a null terminator character. We need to use the return value to know the size of the encoded string when adding it to the builder. --- lib/wp/spa-json.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/wp/spa-json.c b/lib/wp/spa-json.c index 1649f64b..6c797cf9 100644 --- a/lib/wp/spa-json.c +++ b/lib/wp/spa-json.c @@ -391,9 +391,8 @@ wp_spa_json_new_string (const gchar *value) { size_t size = (strlen (value) * 4) + 2; gchar dst[size]; - spa_json_encode_string (dst, sizeof(dst), value); - return wp_spa_json_new_from_builder ( - wp_spa_json_builder_new_formatted ("%s", dst)); + gint enc_size = spa_json_encode_string (dst, sizeof(dst), value); + return wp_spa_json_new_from_builder (wp_spa_json_builder_new (dst, enc_size)); } /* Args is not a pointer in some architectures, so this needs to be a macro to @@ -970,6 +969,14 @@ builder_add_formatted (WpSpaJsonBuilder *self, const gchar *fmt, ...) self->size += s; } +static void +builder_add (WpSpaJsonBuilder *self, const gchar *data, size_t size) +{ + g_return_if_fail (self->max_size - self->size >= size + 1); + snprintf (self->data + self->size, size + 1, "%s", data); + self->size += size; +} + static void builder_add_json (WpSpaJsonBuilder *self, WpSpaJson *json) { @@ -990,10 +997,12 @@ wp_spa_json_builder_add_property (WpSpaJsonBuilder *self, const gchar *key) { size_t size = (strlen (key) * 4) + 3; gchar dst[size]; + gint enc_size; ensure_separator (self, TRUE); ensure_allocated_max_size (self, size); - spa_json_encode_string (dst, sizeof(dst), key); - builder_add_formatted (self, "%s:", dst); + enc_size = spa_json_encode_string (dst, sizeof(dst), key); + builder_add (self, dst, enc_size); + builder_add (self, ":", 1); } /*! @@ -1067,10 +1076,11 @@ wp_spa_json_builder_add_string (WpSpaJsonBuilder *self, const gchar *value) { size_t size = (strlen (value) * 4) + 2; gchar dst[size]; + gint enc_size; ensure_separator (self, FALSE); ensure_allocated_max_size (self, size); - spa_json_encode_string (dst, sizeof(dst), value); - builder_add_formatted (self, "%s", dst); + enc_size = spa_json_encode_string (dst, sizeof(dst), value); + builder_add (self, dst, enc_size); } /*! -- GitLab