Accepting request 304262 from multimedia:libs

1

OBS-URL: https://build.opensuse.org/request/show/304262
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/alsa-utils?expand=0&rev=98
This commit is contained in:
Dominique Leuenberger 2015-04-30 09:49:39 +00:00 committed by Git OBS Bridge
commit e48670e029
5 changed files with 162 additions and 0 deletions

View File

@ -0,0 +1,36 @@
From 1a19ec15385033b59ebfffec954034680575a003 Mon Sep 17 00:00:00 2001
From: Peter Meerwald <p.meerwald@bct-electronic.com>
Date: Tue, 3 Mar 2015 18:39:52 +0100
Subject: [PATCH 1/3] amixer: Don't set only the first item in sset_enum()
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
amixer/amixer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/amixer/amixer.c b/amixer/amixer.c
index ed60e7c3a960..36c92eb99bc9 100644
--- a/amixer/amixer.c
+++ b/amixer/amixer.c
@@ -1278,7 +1278,7 @@ static int get_enum_item_index(snd_mixer_elem_t *elem, char **ptrp)
static int sset_enum(snd_mixer_elem_t *elem, unsigned int argc, char **argv)
{
- unsigned int idx, chn = 0;
+ unsigned int idx, item = 0;
int check_flag = ignore_error ? 0 : -1;
for (idx = 1; idx < argc; idx++) {
@@ -1287,7 +1287,7 @@ static int sset_enum(snd_mixer_elem_t *elem, unsigned int argc, char **argv)
int ival = get_enum_item_index(elem, &ptr);
if (ival < 0)
return check_flag;
- if (snd_mixer_selem_set_enum_item(elem, chn, ival) >= 0)
+ if (snd_mixer_selem_set_enum_item(elem, item++, ival) >= 0)
check_flag = 1;
/* skip separators */
while (*ptr == ',' || isspace(*ptr))
--
2.3.5

View File

@ -0,0 +1,58 @@
From f3abdeea00ef7cc07cb44aa43701a278b9c4692f Mon Sep 17 00:00:00 2001
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Date: Thu, 9 Apr 2015 01:30:56 +0900
Subject: [PATCH 2/3] amixer: expand local storage for item name according to
kernel code
According to kernel code (snd_ctl_elem_init_enum_names() in
sound/core/control.c), the maximum length of item name is 63 characters
(+ 1 terminator = 64 bytes). But current amixer implementation
uses 40 bytes. This causes name truncation and fail to operation.
This commit fixes this bug by expanding the length of local variables.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
amixer/amixer.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/amixer/amixer.c b/amixer/amixer.c
index 36c92eb99bc9..db1849333da3 100644
--- a/amixer/amixer.c
+++ b/amixer/amixer.c
@@ -812,7 +812,11 @@ static int show_selem(snd_mixer_t *handle, snd_mixer_selem_id_t *id, const char
if (snd_mixer_selem_is_enumerated(elem)) {
int i, items;
unsigned int idx;
- char itemname[40];
+ /*
+ * See snd_ctl_elem_init_enum_names() in
+ * sound/core/control.c.
+ */
+ char itemname[64];
items = snd_mixer_selem_get_enum_items(elem);
printf(" Items:");
for (i = 0; i < items; i++) {
@@ -1255,7 +1259,9 @@ static int get_enum_item_index(snd_mixer_elem_t *elem, char **ptrp)
{
char *ptr = *ptrp;
int items, i, len;
- char name[40];
+
+ /* See snd_ctl_elem_init_enum_names() in sound/core/control.c. */
+ char name[64];
items = snd_mixer_selem_get_enum_items(elem);
if (items <= 0)
@@ -1264,6 +1270,7 @@ static int get_enum_item_index(snd_mixer_elem_t *elem, char **ptrp)
for (i = 0; i < items; i++) {
if (snd_mixer_selem_get_enum_item_name(elem, i, sizeof(name)-1, name) < 0)
continue;
+
len = strlen(name);
if (! strncmp(name, ptr, len)) {
if (! ptr[len] || ptr[len] == ',' || ptr[len] == '\n') {
--
2.3.5

View File

@ -0,0 +1,53 @@
From 8188c2466a7d2179aba4e243ff2b85363961f9f1 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 27 Apr 2015 21:27:05 +0200
Subject: [PATCH 3/3] alsa-info: Don't try update when wget isn't available
... otherwise it overwrites a zero size file. Also add a check of
zero size file in the update procedure, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
alsa-info/alsa-info.sh | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index acd849588141..0bc4cd0612fb 100755
--- a/alsa-info/alsa-info.sh
+++ b/alsa-info/alsa-info.sh
@@ -35,6 +35,8 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION"
PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
#Define some simple functions
+WGET=$(which wget 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
+
pbcheck(){
[[ $UPLOAD = "no" ]] && return
@@ -46,10 +48,12 @@ pbcheck(){
}
update() {
+ test -z "$WGET" -o ! -x "$WGET" && return
+
SHFILE=`mktemp -t alsa-info.XXXXXXXXXX` || exit 1
wget -O $SHFILE "http://www.alsa-project.org/alsa-info.sh" >/dev/null 2>&1
REMOTE_VERSION=`grep SCRIPT_VERSION $SHFILE |head -n1 |sed 's/.*=//'`
- if [ "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
+ if [ -s "$SHFILE" -a "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
if [[ -n $DIALOG ]]
then
OVERWRITE=
@@ -831,8 +835,7 @@ if [ "$UPLOAD" = "no" ]; then
fi # UPLOAD
#Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it doesnt.
-if
-WGET=$(which wget 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null); [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ `wget --help |grep post-file` ]]
+if [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ `wget --help |grep post-file` ]]
then
if [[ -n $DIALOG ]]
--
2.3.5

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon Apr 27 21:41:13 CEST 2015 - tiwai@suse.de
- Backport upstream fixes, including the fix for alsa-info
(boo#928394):
0001-amixer-Don-t-set-only-the-first-item-in-sset_enum.patch
0002-amixer-expand-local-storage-for-item-name-according-.patch
0003-alsa-info-Don-t-try-update-when-wget-isn-t-available.patch
-------------------------------------------------------------------
Thu Feb 26 17:26:56 CET 2015 - tiwai@suse.de

View File

@ -45,6 +45,9 @@ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{package_versio
Source1: 01beep.conf
# Patch: alsa-utils-git-fixes.diff
# upstream fix patches
Patch1: 0001-amixer-Don-t-set-only-the-first-item-in-sset_enum.patch
Patch2: 0002-amixer-expand-local-storage-for-item-name-according-.patch
Patch3: 0003-alsa-info-Don-t-try-update-when-wget-isn-t-available.patch
#
Patch99: alsa-utils-gettext-version-removal.diff
BuildRequires: alsa-devel
@ -72,6 +75,9 @@ Sound Architecture.
sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am
# rm -f po/Makefile* po/*.gmo po/*.pot po/*.header po/stamp-*
# patch -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
#
%if 0%{?suse_version} < 1020
%patch99 -p1