From d98c8953ffedc6865b14ee95ac26efacbfbd473dbc5f5fa64d8b24829c73e23f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 19 Jun 2012 10:54:24 +0000 Subject: [PATCH] Accepting request 125415 from home:tiwai:branches:multimedia:libs - Make beep silent as default (bnc#767270) - Backport fixes for alsactl init - Fix invalid .LO entry in man page OBS-URL: https://build.opensuse.org/request/show/125415 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=54 --- ...y-.conf-files-when-a-directory-is-pa.patch | 117 ++++++++++++++++++ ...rence-to-alsactl_init-7-in-alsactl-m.patch | 28 +++++ ...ve-obsoleted-.LO-entry-from-man-page.patch | 23 ++++ 01beep.conf | 17 +++ alsa-utils.changes | 7 ++ alsa-utils.spec | 10 ++ 6 files changed, 202 insertions(+) create mode 100644 0014-alsactl-Read-only-.conf-files-when-a-directory-is-pa.patch create mode 100644 0015-alsactl-Add-reference-to-alsactl_init-7-in-alsactl-m.patch create mode 100644 0016-aseqnet-Remove-obsoleted-.LO-entry-from-man-page.patch create mode 100644 01beep.conf diff --git a/0014-alsactl-Read-only-.conf-files-when-a-directory-is-pa.patch b/0014-alsactl-Read-only-.conf-files-when-a-directory-is-pa.patch new file mode 100644 index 0000000..4b81cbc --- /dev/null +++ b/0014-alsactl-Read-only-.conf-files-when-a-directory-is-pa.patch @@ -0,0 +1,117 @@ +From c68a3d02d161ccb6358620fb6442bc5c194f20f1 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 14 Jun 2012 13:14:48 +0200 +Subject: [PATCH 14/15] alsactl: Read only *.conf files when a directory is + passed via INCLUDE + +When alsactl init is invoked and a directory path is passed to INCLUDE +command in the config file, read only *.conf files in that directory. +This will avoid reading backup files or invalid files that have been +created accidentally. + +Also by using scandir() with alphasort(), alsactl reads the files in +alphabetical order. Thus it's highly recommended to use some number +prefix to the file name for assuring the order. + +Signed-off-by: Takashi Iwai +--- + alsactl/alsactl_init.xml | 10 +++++++++- + alsactl/init_parse.c | 35 +++++++++++++++++++++++++---------- + 2 files changed, 34 insertions(+), 11 deletions(-) + +diff --git a/alsactl/alsactl_init.xml b/alsactl/alsactl_init.xml +index eefe9ef..bce26f5 100644 +--- a/alsactl/alsactl_init.xml ++++ b/alsactl/alsactl_init.xml +@@ -474,7 +474,15 @@ + + + +- Include specified filename or all files in specified directory ++ Include the specified filename or files in specified directory. ++ ++ ++ When a directory is specified, only the files with the ++ extension ".conf" are read. ++ Also they are read in the alphabetical order. ++ Thus it's highly recommended to use some number prefix ++ (e.g. "01-something.conf") to assure the order of execucions. ++ + + + +diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c +index 51b515c..8a7173b 100644 +--- a/alsactl/init_parse.c ++++ b/alsactl/init_parse.c +@@ -1278,6 +1278,13 @@ static char *new_root_dir(const char *filename) + return res; + } + ++/* return non-zero if the file name has the extension ".conf" */ ++static int conf_name_filter(const struct dirent *d) ++{ ++ char *ext = strrchr(d->d_name, '.'); ++ return ext && !strcmp(ext, ".conf"); ++} ++ + static int parse_line(struct space *space, char *line, size_t linesize) + { + char *linepos; +@@ -1480,8 +1487,7 @@ static int parse_line(struct space *space, char *line, size_t linesize) + if (strcasecmp(key, "INCLUDE") == 0) { + char *rootdir, *go_to; + const char *filename; +- struct dirent *dirent; +- DIR *dir; ++ struct stat st; + int linenum; + if (op != KEY_OP_ASSIGN) { + Perror(space, "invalid INCLUDE operation"); +@@ -1498,18 +1504,27 @@ static int parse_line(struct space *space, char *line, size_t linesize) + go_to = space->go_to; + filename = space->filename; + linenum = space->linenum; +- dir = opendir(string); +- if (dir) { ++ if (stat(string, &st)) { ++ Perror(space, "invalid filename '%s'", string); ++ continue; ++ } ++ if (S_ISDIR(st.st_mode)) { ++ struct dirent **list; ++ int i, num; ++ num = scandir(string, &list, conf_name_filter, ++ alphasort); ++ if (num < 0) { ++ Perror(space, "invalid directory '%s'", string); ++ continue; ++ } + count = strlen(string); +- while ((dirent = readdir(dir)) != NULL) { +- if (strcmp(dirent->d_name, ".") == 0 || +- strcmp(dirent->d_name, "..") == 0) +- continue; ++ for (i = 0; i < num; i++) { + string[count] = '\0'; + strlcat(string, "/", sizeof(string)); +- strlcat(string, dirent->d_name, sizeof(string)); ++ strlcat(string, list[i]->d_name, sizeof(string)); + space->go_to = NULL; + space->rootdir = new_root_dir(string); ++ free(list[i]); + if (space->rootdir) { + err = parse(space, string); + free(space->rootdir); +@@ -1522,7 +1537,7 @@ static int parse_line(struct space *space, char *line, size_t linesize) + if (err) + break; + } +- closedir(dir); ++ free(list); + } else { + space->go_to = NULL; + space->rootdir = new_root_dir(string); +-- +1.7.10.4 + diff --git a/0015-alsactl-Add-reference-to-alsactl_init-7-in-alsactl-m.patch b/0015-alsactl-Add-reference-to-alsactl_init-7-in-alsactl-m.patch new file mode 100644 index 0000000..59f17f8 --- /dev/null +++ b/0015-alsactl-Add-reference-to-alsactl_init-7-in-alsactl-m.patch @@ -0,0 +1,28 @@ +From c3111571dc6a45e20c79a2c4fa590101d35db822 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 14 Jun 2012 16:14:29 +0200 +Subject: [PATCH 15/15] alsactl: Add reference to alsactl_init(7) in alsactl + man page + +Signed-off-by: Takashi Iwai +--- + alsactl/alsactl.1 | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/alsactl/alsactl.1 b/alsactl/alsactl.1 +index eb5968c..054f511 100644 +--- a/alsactl/alsactl.1 ++++ b/alsactl/alsactl.1 +@@ -107,7 +107,8 @@ routing options, etc). + \fB + amixer(1), + alsamixer(1), +-aplay(1) ++aplay(1), ++alsactl_init(7) + \fP + + .SH BUGS +-- +1.7.10.4 + diff --git a/0016-aseqnet-Remove-obsoleted-.LO-entry-from-man-page.patch b/0016-aseqnet-Remove-obsoleted-.LO-entry-from-man-page.patch new file mode 100644 index 0000000..5858128 --- /dev/null +++ b/0016-aseqnet-Remove-obsoleted-.LO-entry-from-man-page.patch @@ -0,0 +1,23 @@ +From 2b31992c799488c5a93bfe0b17d64b5196b122b4 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Fri, 15 Jun 2012 16:34:55 +0200 +Subject: [PATCH] aseqnet: Remove obsoleted .LO entry from man page + +Signed-off-by: Takashi Iwai +--- + seq/aseqnet/aseqnet.1 | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/seq/aseqnet/aseqnet.1 b/seq/aseqnet/aseqnet.1 +index a1dc1d3..2cb6eb7 100644 +--- a/seq/aseqnet/aseqnet.1 ++++ b/seq/aseqnet/aseqnet.1 +@@ -1,5 +1,4 @@ + .TH aseqnet 1 "January 1, 2000" +-.LO 1 + .SH NAME + aseqnet \- ALSA sequencer connectors over network + +-- +1.7.10.4 + diff --git a/01beep.conf b/01beep.conf new file mode 100644 index 0000000..76b5f3f --- /dev/null +++ b/01beep.conf @@ -0,0 +1,17 @@ +CTL{reset}="mixer" +CTL{name}="PC Speaker Playback Volume",CTL{do_search}=="1", \ + CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="0" +CTL{name}="PC Speaker Playback Switch",CTL{do_search}=="1", \ + CTL{values}="off" + +CTL{reset}="mixer" +CTL{name}="PC Beep Playback Volume",CTL{do_search}=="1", \ + CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="0" +CTL{name}="PC Beep Playback Switch",CTL{do_search}=="1", \ + CTL{values}="off" + +CTL{reset}="mixer" +CTL{name}="Beep Playback Volume",CTL{do_search}=="1", \ + CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="0" +CTL{name}="Beep Playback Switch",CTL{do_search}=="1", \ + CTL{values}="off" diff --git a/alsa-utils.changes b/alsa-utils.changes index e1c69c9..b7f9078 100644 --- a/alsa-utils.changes +++ b/alsa-utils.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Jun 15 15:41:10 CEST 2012 - tiwai@suse.de + +- Make beep silent as default (bnc#767270) +- Backport fixes for alsactl init +- Fix invalid .LO entry in man page + ------------------------------------------------------------------- Tue May 29 11:25:14 CEST 2012 - tiwai@suse.de diff --git a/alsa-utils.spec b/alsa-utils.spec index b630b37..237b6e2 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -42,6 +42,7 @@ Group: Productivity/Multimedia/Sound/Players Version: 1.0.25 Release: 0 Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{package_version}.tar.bz2 +Source1: 01beep.conf # Patch: alsa-utils-git-fixes.diff Patch1: 0001-Fix-the-examples-in-aplay.1.patch Patch2: 0002-Trivial-fixes-in-INSTALL-file.patch @@ -55,6 +56,9 @@ Patch10: 0010-configure.in-use-AS_HELP_STRING-everywhere.patch Patch11: 0011-alsactl-Do-not-access-other-cards-than-specified-for.patch Patch12: 0012-aplay-print-vu-meter-to-stderr-not-stdout.patch Patch13: 0013-alsaloop-fix-the-avail_min-setup.patch +Patch14: 0014-alsactl-Read-only-.conf-files-when-a-directory-is-pa.patch +Patch15: 0015-alsactl-Add-reference-to-alsactl_init-7-in-alsactl-m.patch +Patch16: 0016-aseqnet-Remove-obsoleted-.LO-entry-from-man-page.patch Patch99: alsa-utils-gettext-version-removal.diff Url: http://www.alsa-project.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -81,6 +85,9 @@ sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am %patch11 -p1 %patch12 -p1 %patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 %if %suse_version < 1020 %patch99 -p1 %endif @@ -106,6 +113,9 @@ make %{?_smp_mflags} %install %makeinstall +for i in %{_sourcedir}/[0-9]*.conf; do + install -c -m 0644 $i $RPM_BUILD_ROOT%{_datadir}/alsa/init/postinit +done %find_lang %{name} --all-name %if %use_systemd ln -s alsa-restore.service $RPM_BUILD_ROOT/lib/systemd/system/alsasound.service