From ebe6de570b89a80d58af7797fd6fdc246b6c9f2e Mon Sep 17 00:00:00 2001 From: "Igor V. Kovalenko" Date: Sat, 18 Jun 2022 02:37:29 +0300 Subject: media-libs/libpulse: Fix parsing of percentages with decimal points Upstream commit 05c06afa58e30b7958e96766d1e917099c8a4041 Fixes logic for detecting which type of volume was given to pactl. Percentages are now prioritized over all other volume types. Signed-off-by: Igor V. Kovalenko Signed-off-by: Sam James --- .../pulseaudio-16.0-fix-pactl-volume-command.patch | 55 ++++++ media-libs/libpulse/libpulse-16.0-r1.ebuild | 204 +++++++++++++++++++++ 2 files changed, 259 insertions(+) create mode 100644 media-libs/libpulse/files/pulseaudio-16.0-fix-pactl-volume-command.patch create mode 100644 media-libs/libpulse/libpulse-16.0-r1.ebuild (limited to 'media-libs') diff --git a/media-libs/libpulse/files/pulseaudio-16.0-fix-pactl-volume-command.patch b/media-libs/libpulse/files/pulseaudio-16.0-fix-pactl-volume-command.patch new file mode 100644 index 000000000000..469aaa345102 --- /dev/null +++ b/media-libs/libpulse/files/pulseaudio-16.0-fix-pactl-volume-command.patch @@ -0,0 +1,55 @@ +https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/05c06afa58e30b7958e96766d1e917099c8a4041 + +From 05c06afa58e30b7958e96766d1e917099c8a4041 Mon Sep 17 00:00:00 2001 +From: Sean Greenslade +Date: Sat, 4 Jun 2022 00:24:49 -0700 +Subject: [PATCH] pactl: fix parsing of percentages with decimal points + +The logic for detecting which type of volume was given incorrectly interpreted +any value with a decimal as a VOL_LINEAR. It also could set multiple flags, +which would put the flags variable into an indeterminate state. Additionally, +the flags stack variable was uninitialized which could also lead to an +indeterminate flag state. + +Percentages are now prioritized over all other types, and only one type flag +can be set. +--- + src/utils/pactl.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/utils/pactl.c b/src/utils/pactl.c +index 35163f277..2761ebaaf 100644 +--- a/src/utils/pactl.c ++++ b/src/utils/pactl.c +@@ -2527,16 +2527,16 @@ static int parse_volume(const char *vol_spec, pa_volume_t *vol, enum volume_flag + vs = pa_xstrdup(vol_spec); + + *vol_flags = (pa_startswith(vs, "+") || pa_startswith(vs, "-")) ? VOL_RELATIVE : VOL_ABSOLUTE; +- if (strchr(vs, '.')) +- *vol_flags |= VOL_LINEAR; + if (pa_endswith(vs, "%")) { + *vol_flags |= VOL_PERCENT; + vs[strlen(vs)-1] = 0; + } +- if (pa_endswith(vs, "db") || pa_endswith(vs, "dB")) { ++ else if (pa_endswith(vs, "db") || pa_endswith(vs, "dB")) { + *vol_flags |= VOL_DECIBEL; + vs[strlen(vs)-2] = 0; + } ++ else if (strchr(vs, '.')) ++ *vol_flags |= VOL_LINEAR; + + atod_input = vs; + +@@ -2597,7 +2597,7 @@ static int parse_volumes(char *args[], unsigned n) { + + volume.channels = n; + for (i = 0; i < volume.channels; i++) { +- enum volume_flags flags; ++ enum volume_flags flags = 0; + + if (parse_volume(args[i], &volume.values[i], &flags) < 0) + return -1; +-- +GitLab + diff --git a/media-libs/libpulse/libpulse-16.0-r1.ebuild b/media-libs/libpulse/libpulse-16.0-r1.ebuild new file mode 100644 index 000000000000..a134ac58d7b4 --- /dev/null +++ b/media-libs/libpulse/libpulse-16.0-r1.ebuild @@ -0,0 +1,204 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" + +MY_PV="${PV/_pre*}" +MY_P="pulseaudio-${MY_PV}" +inherit bash-completion-r1 gnome2-utils meson-multilib optfeature systemd udev + +DESCRIPTION="Libraries for PulseAudio clients" +HOMEPAGE="https://www.freedesktop.org/wiki/Software/PulseAudio/" + +if [[ ${PV} = 9999 ]]; then + inherit git-r3 + EGIT_BRANCH="master" + EGIT_REPO_URI="https://gitlab.freedesktop.org/pulseaudio/pulseaudio" +else + SRC_URI="https://freedesktop.org/software/pulseaudio/releases/${MY_P}.tar.xz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux" +fi + +S="${WORKDIR}/${MY_P}" + +LICENSE="LGPL-2.1+" + +SLOT="0" +IUSE="+asyncns dbus doc +glib gtk selinux systemd test valgrind X" +RESTRICT="!test? ( test )" + +# NOTE: libpcre needed in some cases, bug #472228 +# TODO: libatomic_ops is only needed on some architectures and conditions, and then at runtime too +RDEPEND=" + dev-libs/libatomic_ops + >=media-libs/libsndfile-1.0.20[${MULTILIB_USEDEP}] + virtual/libc + asyncns? ( >=net-libs/libasyncns-0.1[${MULTILIB_USEDEP}] ) + dbus? ( >=sys-apps/dbus-1.4.12[${MULTILIB_USEDEP}] ) + glib? ( >=dev-libs/glib-2.28.0:2[${MULTILIB_USEDEP}] ) + gtk? ( x11-libs/gtk+:3 ) + selinux? ( sec-policy/selinux-pulseaudio ) + systemd? ( sys-apps/systemd:= ) + valgrind? ( dev-util/valgrind ) + X? ( + x11-libs/libX11[${MULTILIB_USEDEP}] + >=x11-libs/libxcb-1.6[${MULTILIB_USEDEP}] + ) + || ( + elibc_glibc? ( virtual/libc ) + dev-libs/libpcre:3 + ) + !