From unknown Sun Jun 22 00:06:15 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#31239] Make alsa find its plugins Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 22 Apr 2018 17:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 31239 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 31239@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15244172561684 (code B ref -1); Sun, 22 Apr 2018 17:15:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Apr 2018 17:14:16 +0000 Received: from localhost ([127.0.0.1]:35985 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fAIZ5-0000R6-Db for submit@debbugs.gnu.org; Sun, 22 Apr 2018 13:14:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58755) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fAIZ1-0000Qq-V4 for submit@debbugs.gnu.org; Sun, 22 Apr 2018 13:14:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fAIYt-00030F-Sd for submit@debbugs.gnu.org; Sun, 22 Apr 2018 13:14:06 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58493) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fAIYt-0002zs-Lm for submit@debbugs.gnu.org; Sun, 22 Apr 2018 13:14:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAIYq-0006Zs-Hq for guix-patches@gnu.org; Sun, 22 Apr 2018 13:14:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fAIYl-0002ux-Fj for guix-patches@gnu.org; Sun, 22 Apr 2018 13:14:00 -0400 Received: from lepiller.eu ([89.234.186.109]:44608) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fAIYk-0002sG-TZ for guix-patches@gnu.org; Sun, 22 Apr 2018 13:13:55 -0400 Received: from localhost (static-176-182-42-79.ncc.abo.bbox.fr [176.182.42.79]) by lepiller.eu (OpenSMTPD) with ESMTPSA id adca38a5 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Sun, 22 Apr 2018 17:17:05 +0000 (UTC) Date: Sun, 22 Apr 2018 19:13:45 +0200 From: Julien Lepiller Message-ID: <20180422191345.1836dc69@lepiller.eu> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/WQQTEAstTmd7h2.5a/7YZW9" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --MP_/WQQTEAstTmd7h2.5a/7YZW9 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, this patch adds an environment variable, ALSA_PLUGIN_DIR to allow it to find its plugins. This is especially useful in GuixSD where pulseaudio is used by most applications. When running an application that only knows about alsa, no sound can be output because the card is taken by pulse. One solution is to use the pulseaudio plugin from alsa-plugins:pulseaudio and setting ~/.asoundrc: # Default to PulseAudio pcm.!default { type pulse hint { show on description "Default ALSA Output (currently PulseAudio Sound Server)" } } ctl.!default { type pulse } But this results in an error because alsa will look for plugins in its own output directory in the store. With this patch, alsa is able to find its plugins in ALSA_PLUGIN_DIR after exporting it (export ALSA_PLUGIN_DIR=$HOME/.guix-profile/lib/alsa-lib). --MP_/WQQTEAstTmd7h2.5a/7YZW9 Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-gnu-Make-alsa-find-its-plugins-by-setting-ALSA_PLUGI.patch >From 83602af1382c6cfed7824e7931fc54bf66d688e0 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Sun, 22 Apr 2018 19:05:30 +0200 Subject: [PATCH] gnu: Make alsa find its plugins by setting ALSA_PLUGIN_DIR. * gnu/packages/patches/alsa-lib-add-environment-variable.patch: New file. * gnu/packages/linux.scm (alsa-lib)[source]: Use it. [native-search-paths]: Add ALSA_PLUGIN_DIR. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/linux.scm | 9 +- .../alsa-lib-add-environment-variable.patch | 506 ++++++++++++++++++ 3 files changed, 515 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/alsa-lib-add-environment-variable.patch diff --git a/gnu/local.mk b/gnu/local.mk index 056a46cb7..efbf36ac3 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -557,6 +557,7 @@ dist_patch_DATA = \ %D%/packages/patches/aegis-test-fixup-1.patch \ %D%/packages/patches/aegis-test-fixup-2.patch \ %D%/packages/patches/agg-am_c_prototype.patch \ + %D%/packages/patches/alas-lib-add-environment-variable.patch \ %D%/packages/patches/ansible-wrap-program-hack.patch \ %D%/packages/patches/antiword-CVE-2014-8123.patch \ %D%/packages/patches/antlr3-3_1-fix-java8-compilation.patch \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 1d9585e7f..75a8db04e 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -1002,8 +1002,15 @@ intercept and print the system calls executed by the program.") version ".tar.bz2")) (sha256 (base32 - "1rhacnlj0grvfagjx5qzsnbhw7m7lyccghqs4jsv0dnsqv9qmxpl")))) + "1rhacnlj0grvfagjx5qzsnbhw7m7lyccghqs4jsv0dnsqv9qmxpl")) + (patches (search-patches "alsa-lib-add-environment-variable.patch")))) (build-system gnu-build-system) + (native-search-paths + (list (search-path-specification + (variable "ALSA_PLUGIN_DIR") + (file-type 'regular) + (separator #f) ;single entry + (files '("lib/alsa-lib"))))) (home-page "https://www.alsa-project.org/") (synopsis "The Advanced Linux Sound Architecture libraries") (description diff --git a/gnu/packages/patches/alsa-lib-add-environment-variable.patch b/gnu/packages/patches/alsa-lib-add-environment-variable.patch new file mode 100644 index 000000000..d3e1b2859 --- /dev/null +++ b/gnu/packages/patches/alsa-lib-add-environment-variable.patch @@ -0,0 +1,506 @@ +From ef87a17bd2a55dd3247a6ee0a463f3589fc01f08 Mon Sep 17 00:00:00 2001 +From: Julien Lepiller +Date: Sun, 22 Apr 2018 16:28:38 +0200 +Subject: [PATCH] Add support for a ALSA_PLUGIN_DIR environment variable. + +If it is not set, default to previous behavior. +--- + ...a-ALSA_PLUGIN_DIR-environment-variab.patch | 378 ++++++++++++++++++ + src/control/control.c | 8 +- + src/dlmisc.c | 13 +- + src/pcm/pcm.c | 8 +- + src/pcm/pcm_rate.c | 13 +- + 5 files changed, 409 insertions(+), 11 deletions(-) + create mode 100644 0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch + +diff --git a/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch b/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch +new file mode 100644 +index 0000000..7aa6891 +--- /dev/null ++++ b/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch +@@ -0,0 +1,378 @@ ++From 54530c486c9cbf48cbb591d3428075cee9678314 Mon Sep 17 00:00:00 2001 ++From: Julien Lepiller ++Date: Sun, 22 Apr 2018 16:28:38 +0200 ++Subject: [PATCH] Add support for a ALSA_PLUGIN_DIR environment variable. ++ ++If it is not set, default to previous behavior. ++--- ++ ...a-ALSA_PLUGIN_DIR-environment-variab.patch | 249 ++++++++++++++++++ ++ src/control/control.c | 8 +- ++ src/dlmisc.c | 14 +- ++ src/pcm/pcm.c | 8 +- ++ src/pcm/pcm_rate.c | 13 +- ++ 5 files changed, 281 insertions(+), 11 deletions(-) ++ create mode 100644 0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch ++ ++diff --git a/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch b/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch ++new file mode 100644 ++index 0000000..e98acc7 ++--- /dev/null +++++ b/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch ++@@ -0,0 +1,249 @@ +++From f00f0a2e8b9b56114eb6d168d5a22d84a61ecf22 Mon Sep 17 00:00:00 2001 +++From: Julien Lepiller +++Date: Sun, 22 Apr 2018 16:28:38 +0200 +++Subject: [PATCH] Add support for a ALSA_PLUGIN_DIR environment variable. +++ +++If it is not set, default to previous behavior. +++--- +++ ...a-ALSA_PLUGIN_DIR-environment-variab.patch | 120 ++++++++++++++++++ +++ src/control/control.c | 8 +- +++ src/dlmisc.c | 14 +- +++ src/pcm/pcm.c | 8 +- +++ src/pcm/pcm_rate.c | 13 +- +++ 5 files changed, 152 insertions(+), 11 deletions(-) +++ create mode 100644 0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch +++ +++diff --git a/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch b/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch +++new file mode 100644 +++index 0000000..23ace65 +++--- /dev/null ++++++ b/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch +++@@ -0,0 +1,120 @@ ++++From 21e72ff81167f0ec4e4b9b56ac4af546de83557b Mon Sep 17 00:00:00 2001 ++++From: Julien Lepiller ++++Date: Sun, 22 Apr 2018 16:28:38 +0200 ++++Subject: [PATCH] Add support for a ALSA_PLUGIN_DIR environment variable. ++++ ++++If it is not set, default to previous behavior. ++++--- ++++ src/control/control.c | 8 ++++++-- ++++ src/dlmisc.c | 14 +++++++++++--- ++++ src/pcm/pcm.c | 8 ++++++-- ++++ src/pcm/pcm_rate.c | 12 ++++++++---- ++++ 4 files changed, 31 insertions(+), 11 deletions(-) ++++ ++++diff --git a/src/control/control.c b/src/control/control.c ++++index 268c5e9..b2c8f9f 100644 ++++--- a/src/control/control.c +++++++ b/src/control/control.c ++++@@ -1331,13 +1331,17 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, ++++ build_in++; ++++ } ++++ if (*build_in == NULL) { ++++- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); +++++ char* plugdir = ALSA_PLUGIN_DIR; +++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++++ if(envplugdir != NULL) +++++ plugdir = envplugdir; +++++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); ++++ if (buf1 == NULL) { ++++ err = -ENOMEM; ++++ goto _err; ++++ } ++++ lib = buf1; ++++- sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str); +++++ sprintf(buf1, "%s/libasound_module_ctl_%s.so", plugdir, str); ++++ } ++++ } ++++ #ifndef PIC ++++diff --git a/src/dlmisc.c b/src/dlmisc.c ++++index b36c48f..baa4bf8 100644 ++++--- a/src/dlmisc.c +++++++ b/src/dlmisc.c ++++@@ -76,10 +76,18 @@ void *snd_dlopen(const char *name, int mode) ++++ char *filename; ++++ ++++ if (name && name[0] != '/') { +++++ char* plugdir = ALSA_PLUGIN_DIR; +++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++++ if(envplugdir != NULL) +++++ plugdir = envplugdir; +++++ ++++ filename = malloc(sizeof(ALSA_PLUGIN_DIR) + 1 + strlen(name) + 1); ++++- strcpy(filename, ALSA_PLUGIN_DIR); ++++- strcat(filename, "/"); ++++- strcat(filename, name); +++++ if (filename == NULL) { +++++ err = -ENOMEM; +++++ return NULL; +++++ } +++++ +++++ sprintf(filename, "%s/%s", plugdir, name); ++++ handle = dlopen(filename, mode); ++++ free(filename); ++++ } ++++diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c ++++index fc7bd52..1a64490 100644 ++++--- a/src/pcm/pcm.c +++++++ b/src/pcm/pcm.c ++++@@ -2432,13 +2432,17 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, ++++ build_in++; ++++ } ++++ if (*build_in == NULL) { ++++- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); +++++ char* plugdir = ALSA_PLUGIN_DIR; +++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++++ if(envplugdir != NULL) +++++ plugdir = envplugdir; +++++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); ++++ if (buf1 == NULL) { ++++ err = -ENOMEM; ++++ goto _err; ++++ } ++++ lib = buf1; ++++- sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str); +++++ sprintf(buf1, "%s/libasound_module_pcm_%s.so", plugdir, str); ++++ } ++++ } ++++ #ifndef PIC ++++diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c ++++index f60b0ae..2c62842 100644 ++++--- a/src/pcm/pcm_rate.c +++++++ b/src/pcm/pcm_rate.c ++++@@ -1260,7 +1260,7 @@ static const char *const default_rate_plugins[] = { ++++ ++++ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_config_t *converter_conf, int verbose) ++++ { ++++- char open_name[64], open_conf_name[64], lib_name[128], *lib = NULL; +++++ char open_name[64], open_conf_name[64], *lib = NULL; ++++ snd_pcm_rate_open_func_t open_func; ++++ snd_pcm_rate_open_conf_func_t open_conf_func; ++++ int err; ++++@@ -1268,9 +1268,13 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf ++++ snprintf(open_name, sizeof(open_name), "_snd_pcm_rate_%s_open", type); ++++ snprintf(open_conf_name, sizeof(open_conf_name), "_snd_pcm_rate_%s_open_conf", type); ++++ if (!is_builtin_plugin(type)) { ++++- snprintf(lib_name, sizeof(lib_name), ++++- "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type); ++++- lib = lib_name; +++++ char* plugdir = ALSA_PLUGIN_DIR; +++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++++ if(envplugdir != NULL) +++++ plugdir = envplugdir; +++++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); +++++ sprintf(buf1, "%s/libasound_module_rate_%s.so", plugdir, type); +++++ lib = buf1; ++++ } ++++ ++++ rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; ++++-- ++++2.17.0 ++++ +++diff --git a/src/control/control.c b/src/control/control.c +++index 268c5e9..b2c8f9f 100644 +++--- a/src/control/control.c ++++++ b/src/control/control.c +++@@ -1331,13 +1331,17 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, +++ build_in++; +++ } +++ if (*build_in == NULL) { +++- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); ++++ char* plugdir = ALSA_PLUGIN_DIR; ++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++++ if(envplugdir != NULL) ++++ plugdir = envplugdir; ++++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); +++ if (buf1 == NULL) { +++ err = -ENOMEM; +++ goto _err; +++ } +++ lib = buf1; +++- sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str); ++++ sprintf(buf1, "%s/libasound_module_ctl_%s.so", plugdir, str); +++ } +++ } +++ #ifndef PIC +++diff --git a/src/dlmisc.c b/src/dlmisc.c +++index b36c48f..baa4bf8 100644 +++--- a/src/dlmisc.c ++++++ b/src/dlmisc.c +++@@ -76,10 +76,18 @@ void *snd_dlopen(const char *name, int mode) +++ char *filename; +++ +++ if (name && name[0] != '/') { ++++ char* plugdir = ALSA_PLUGIN_DIR; ++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++++ if(envplugdir != NULL) ++++ plugdir = envplugdir; ++++ +++ filename = malloc(sizeof(ALSA_PLUGIN_DIR) + 1 + strlen(name) + 1); +++- strcpy(filename, ALSA_PLUGIN_DIR); +++- strcat(filename, "/"); +++- strcat(filename, name); ++++ if (filename == NULL) { ++++ err = -ENOMEM; ++++ return NULL; ++++ } ++++ ++++ sprintf(filename, "%s/%s", plugdir, name); +++ handle = dlopen(filename, mode); +++ free(filename); +++ } +++diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c +++index fc7bd52..1a64490 100644 +++--- a/src/pcm/pcm.c ++++++ b/src/pcm/pcm.c +++@@ -2432,13 +2432,17 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, +++ build_in++; +++ } +++ if (*build_in == NULL) { +++- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); ++++ char* plugdir = ALSA_PLUGIN_DIR; ++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++++ if(envplugdir != NULL) ++++ plugdir = envplugdir; ++++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); +++ if (buf1 == NULL) { +++ err = -ENOMEM; +++ goto _err; +++ } +++ lib = buf1; +++- sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str); ++++ sprintf(buf1, "%s/libasound_module_pcm_%s.so", plugdir, str); +++ } +++ } +++ #ifndef PIC +++diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c +++index f60b0ae..72a1723 100644 +++--- a/src/pcm/pcm_rate.c ++++++ b/src/pcm/pcm_rate.c +++@@ -1260,7 +1260,8 @@ static const char *const default_rate_plugins[] = { +++ +++ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_config_t *converter_conf, int verbose) +++ { +++- char open_name[64], open_conf_name[64], lib_name[128], *lib = NULL; ++++ char open_name[64], open_conf_name[64], *lib = NULL; ++++ char *buf1; +++ snd_pcm_rate_open_func_t open_func; +++ snd_pcm_rate_open_conf_func_t open_conf_func; +++ int err; +++@@ -1268,9 +1269,13 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf +++ snprintf(open_name, sizeof(open_name), "_snd_pcm_rate_%s_open", type); +++ snprintf(open_conf_name, sizeof(open_conf_name), "_snd_pcm_rate_%s_open_conf", type); +++ if (!is_builtin_plugin(type)) { +++- snprintf(lib_name, sizeof(lib_name), +++- "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type); +++- lib = lib_name; ++++ char* plugdir = ALSA_PLUGIN_DIR; ++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++++ if(envplugdir != NULL) ++++ plugdir = envplugdir; ++++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); ++++ sprintf(buf1, "%s/libasound_module_rate_%s.so", plugdir, type); ++++ lib = buf1; +++ } +++ +++ rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; +++-- +++2.17.0 +++ ++diff --git a/src/control/control.c b/src/control/control.c ++index 268c5e9..b2c8f9f 100644 ++--- a/src/control/control.c +++++ b/src/control/control.c ++@@ -1331,13 +1331,17 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, ++ build_in++; ++ } ++ if (*build_in == NULL) { ++- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); +++ char* plugdir = ALSA_PLUGIN_DIR; +++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++ if(envplugdir != NULL) +++ plugdir = envplugdir; +++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); ++ if (buf1 == NULL) { ++ err = -ENOMEM; ++ goto _err; ++ } ++ lib = buf1; ++- sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str); +++ sprintf(buf1, "%s/libasound_module_ctl_%s.so", plugdir, str); ++ } ++ } ++ #ifndef PIC ++diff --git a/src/dlmisc.c b/src/dlmisc.c ++index b36c48f..baa4bf8 100644 ++--- a/src/dlmisc.c +++++ b/src/dlmisc.c ++@@ -76,10 +76,18 @@ void *snd_dlopen(const char *name, int mode) ++ char *filename; ++ ++ if (name && name[0] != '/') { +++ char* plugdir = ALSA_PLUGIN_DIR; +++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++ if(envplugdir != NULL) +++ plugdir = envplugdir; +++ ++ filename = malloc(sizeof(ALSA_PLUGIN_DIR) + 1 + strlen(name) + 1); ++- strcpy(filename, ALSA_PLUGIN_DIR); ++- strcat(filename, "/"); ++- strcat(filename, name); +++ if (filename == NULL) { +++ err = -ENOMEM; +++ return NULL; +++ } +++ +++ sprintf(filename, "%s/%s", plugdir, name); ++ handle = dlopen(filename, mode); ++ free(filename); ++ } ++diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c ++index fc7bd52..1a64490 100644 ++--- a/src/pcm/pcm.c +++++ b/src/pcm/pcm.c ++@@ -2432,13 +2432,17 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, ++ build_in++; ++ } ++ if (*build_in == NULL) { ++- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); +++ char* plugdir = ALSA_PLUGIN_DIR; +++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++ if(envplugdir != NULL) +++ plugdir = envplugdir; +++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); ++ if (buf1 == NULL) { ++ err = -ENOMEM; ++ goto _err; ++ } ++ lib = buf1; ++- sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str); +++ sprintf(buf1, "%s/libasound_module_pcm_%s.so", plugdir, str); ++ } ++ } ++ #ifndef PIC ++diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c ++index f60b0ae..4bc9006 100644 ++--- a/src/pcm/pcm_rate.c +++++ b/src/pcm/pcm_rate.c ++@@ -1260,7 +1260,8 @@ static const char *const default_rate_plugins[] = { ++ ++ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_config_t *converter_conf, int verbose) ++ { ++- char open_name[64], open_conf_name[64], lib_name[128], *lib = NULL; +++ char open_name[64], open_conf_name[64], *lib = NULL; +++ char *buf1; ++ snd_pcm_rate_open_func_t open_func; ++ snd_pcm_rate_open_conf_func_t open_conf_func; ++ int err; ++@@ -1268,9 +1269,13 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf ++ snprintf(open_name, sizeof(open_name), "_snd_pcm_rate_%s_open", type); ++ snprintf(open_conf_name, sizeof(open_conf_name), "_snd_pcm_rate_%s_open_conf", type); ++ if (!is_builtin_plugin(type)) { ++- snprintf(lib_name, sizeof(lib_name), ++- "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type); ++- lib = lib_name; +++ char* plugdir = ALSA_PLUGIN_DIR; +++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++ if(envplugdir != NULL) +++ plugdir = envplugdir; +++ buf1 = malloc(strlen(type) + strlen(plugdir) + 32); +++ sprintf(buf1, "%s/libasound_module_rate_%s.so", plugdir, type); +++ lib = buf1; ++ } ++ ++ rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; ++-- ++2.17.0 ++ +diff --git a/src/control/control.c b/src/control/control.c +index 268c5e9..b2c8f9f 100644 +--- a/src/control/control.c ++++ b/src/control/control.c +@@ -1331,13 +1331,17 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, + build_in++; + } + if (*build_in == NULL) { +- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); ++ char* plugdir = ALSA_PLUGIN_DIR; ++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++ if(envplugdir != NULL) ++ plugdir = envplugdir; ++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); + if (buf1 == NULL) { + err = -ENOMEM; + goto _err; + } + lib = buf1; +- sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str); ++ sprintf(buf1, "%s/libasound_module_ctl_%s.so", plugdir, str); + } + } + #ifndef PIC +diff --git a/src/dlmisc.c b/src/dlmisc.c +index b36c48f..f6af8fe 100644 +--- a/src/dlmisc.c ++++ b/src/dlmisc.c +@@ -76,10 +76,17 @@ void *snd_dlopen(const char *name, int mode) + char *filename; + + if (name && name[0] != '/') { ++ char* plugdir = ALSA_PLUGIN_DIR; ++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++ if(envplugdir != NULL) ++ plugdir = envplugdir; ++ + filename = malloc(sizeof(ALSA_PLUGIN_DIR) + 1 + strlen(name) + 1); +- strcpy(filename, ALSA_PLUGIN_DIR); +- strcat(filename, "/"); +- strcat(filename, name); ++ if (filename == NULL) { ++ return NULL; ++ } ++ ++ sprintf(filename, "%s/%s", plugdir, name); + handle = dlopen(filename, mode); + free(filename); + } +diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c +index fc7bd52..1a64490 100644 +--- a/src/pcm/pcm.c ++++ b/src/pcm/pcm.c +@@ -2432,13 +2432,17 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, + build_in++; + } + if (*build_in == NULL) { +- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); ++ char* plugdir = ALSA_PLUGIN_DIR; ++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++ if(envplugdir != NULL) ++ plugdir = envplugdir; ++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); + if (buf1 == NULL) { + err = -ENOMEM; + goto _err; + } + lib = buf1; +- sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str); ++ sprintf(buf1, "%s/libasound_module_pcm_%s.so", plugdir, str); + } + } + #ifndef PIC +diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c +index f60b0ae..4bc9006 100644 +--- a/src/pcm/pcm_rate.c ++++ b/src/pcm/pcm_rate.c +@@ -1260,7 +1260,8 @@ static const char *const default_rate_plugins[] = { + + static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_config_t *converter_conf, int verbose) + { +- char open_name[64], open_conf_name[64], lib_name[128], *lib = NULL; ++ char open_name[64], open_conf_name[64], *lib = NULL; ++ char *buf1; + snd_pcm_rate_open_func_t open_func; + snd_pcm_rate_open_conf_func_t open_conf_func; + int err; +@@ -1268,9 +1269,13 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf + snprintf(open_name, sizeof(open_name), "_snd_pcm_rate_%s_open", type); + snprintf(open_conf_name, sizeof(open_conf_name), "_snd_pcm_rate_%s_open_conf", type); + if (!is_builtin_plugin(type)) { +- snprintf(lib_name, sizeof(lib_name), +- "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type); +- lib = lib_name; ++ char* plugdir = ALSA_PLUGIN_DIR; ++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++ if(envplugdir != NULL) ++ plugdir = envplugdir; ++ buf1 = malloc(strlen(type) + strlen(plugdir) + 32); ++ sprintf(buf1, "%s/libasound_module_rate_%s.so", plugdir, type); ++ lib = buf1; + } + + rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; +-- +2.17.0 + -- 2.17.0 --MP_/WQQTEAstTmd7h2.5a/7YZW9-- From unknown Sun Jun 22 00:06:15 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#31239] Make alsa find its plugins Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 17 May 2018 06:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31239 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Julien Lepiller Cc: 31239@debbugs.gnu.org Received: via spool by 31239-submit@debbugs.gnu.org id=B31239.152653691711951 (code B ref 31239); Thu, 17 May 2018 06:02:01 +0000 Received: (at 31239) by debbugs.gnu.org; 17 May 2018 06:01:57 +0000 Received: from localhost ([127.0.0.1]:37856 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJBzB-00036h-AS for submit@debbugs.gnu.org; Thu, 17 May 2018 02:01:57 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:39876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJBz8-00036X-Gn for 31239@debbugs.gnu.org; Thu, 17 May 2018 02:01:56 -0400 Received: from localhost (178.113.183.200.wireless.dyn.drei.com [178.113.183.200]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 86C3133601BF; Thu, 17 May 2018 08:01:52 +0200 (CEST) Date: Thu, 17 May 2018 08:01:43 +0200 From: Danny Milosavljevic Message-ID: <20180517080143.06b1113a@scratchpost.org> In-Reply-To: <20180422191345.1836dc69@lepiller.eu> References: <20180422191345.1836dc69@lepiller.eu> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/79Hvh5JLjo26mANbwOVvwNB"; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/79Hvh5JLjo26mANbwOVvwNB Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Julien, good idea! The indentation in the patch files is off (alsa-lib uses tabs in its source= code). Also, what is 0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.pat= ch embedded in this patch for? Maybe for upstream? Nice :) You already patch the individual files in alsa-lib. Note: It would be possible to use ++ char* plugdir =3D getenv("ALSA_PLUGIN_DIR") ?: ALSA_PLUGIN_DIR; instead of ++ char* plugdir =3D ALSA_PLUGIN_DIR; ++ char* envplugdir =3D getenv("ALSA_PLUGIN_DIR"); ++ if(envplugdir !=3D NULL) ++ plugdir =3D envplugdir; (especially since it's repeated multiple times) but maybe that's too obscur= e. So LGTM except for the indentation and extra patch file! --Sig_/79Hvh5JLjo26mANbwOVvwNB Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlr9GscACgkQ5xo1VCww uqXY1gf+LT7qPxkyylXr7ALsy1Wv02AIiJsvQkfY1Vo56Eshq1iS6Bzqd6Mb2ElD 6m/6s5rYrjNxBFcGDFcnfyMt5kLNnpGTuLjJmjtCE4P1CiNiSPXQey99YkkuttFc NjrM2vHcohCfv60Ofq0CjJ3tV/QmfO/ZwLM6QR1dYKJ43YFp854jBLTd1iFf/XG3 qFhpYQePqTaV/tsUFZyKx9LTboQflus9R6YrFS3ZJx5GQfF1ZXL6ZYQID0/2nabW TKH/1NeUnBG2hK4vQVdfGRHAVPyPfeAAh5l94bUqHme5bLE/R7Pe5EnFKmRHwPX2 GUIxINJI83qf8bxWX0hf5R8GULNBhg== =J0as -----END PGP SIGNATURE----- --Sig_/79Hvh5JLjo26mANbwOVvwNB-- From unknown Sun Jun 22 00:06:15 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Julien Lepiller Subject: bug#31239: closed (Re: [bug#31239] Make alsa find its plugins) Message-ID: References: <20180527190726.32ea8178@lepiller.eu> <20180422191345.1836dc69@lepiller.eu> X-Gnu-PR-Message: they-closed 31239 X-Gnu-PR-Package: guix-patches Reply-To: 31239@debbugs.gnu.org Date: Sun, 27 May 2018 17:08:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1527440882-18155-1" This is a multi-part message in MIME format... ------------=_1527440882-18155-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #31239: Make alsa find its plugins which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 31239@debbugs.gnu.org. --=20 31239: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D31239 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1527440882-18155-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 31239-done) by debbugs.gnu.org; 27 May 2018 17:07:35 +0000 Received: from localhost ([127.0.0.1]:51167 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fMz8p-0004hw-7g for submit@debbugs.gnu.org; Sun, 27 May 2018 13:07:35 -0400 Received: from lepiller.eu ([89.234.186.109]:54102) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fMz8n-0004hm-1K for 31239-done@debbugs.gnu.org; Sun, 27 May 2018 13:07:33 -0400 Received: from localhost (static-176-182-42-79.ncc.abo.bbox.fr [176.182.42.79]) by lepiller.eu (OpenSMTPD) with ESMTPSA id e5eb9c5b (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO) for <31239-done@debbugs.gnu.org>; Sun, 27 May 2018 17:09:31 +0000 (UTC) Date: Sun, 27 May 2018 19:07:26 +0200 From: Julien Lepiller To: 31239-done@debbugs.gnu.org Subject: Re: [bug#31239] Make alsa find its plugins Message-ID: <20180527190726.32ea8178@lepiller.eu> In-Reply-To: <20180517080143.06b1113a@scratchpost.org> References: <20180422191345.1836dc69@lepiller.eu> <20180517080143.06b1113a@scratchpost.org> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/7USZMM=2pOIgMYGpWDp.Ku0"; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 31239-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Sig_/7USZMM=2pOIgMYGpWDp.Ku0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Le Thu, 17 May 2018 08:01:43 +0200, Danny Milosavljevic a =C3=A9crit : > Hi Julien, >=20 > good idea! >=20 > The indentation in the patch files is off (alsa-lib uses tabs in its > source code). >=20 > Also, what is > 0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch > embedded in this patch for? Maybe for upstream? Nice :) >=20 > You already patch the individual files in alsa-lib. >=20 > Note: It would be possible to use >=20 > ++ char* plugdir =3D getenv("ALSA_PLUGIN_DIR") ?: ALSA_PLUGIN_DIR; >=20 > instead of >=20 > ++ char* plugdir =3D ALSA_PLUGIN_DIR; > ++ char* envplugdir =3D getenv("ALSA_PLUGIN_DIR"); > ++ if(envplugdir !=3D NULL) > ++ plugdir =3D envplugdir; >=20 > (especially since it's repeated multiple times) but maybe that's too > obscure. >=20 > So LGTM except for the indentation and extra patch file! Pushed as 2101cc3fb691f443b830fdf5f846ded5fa018739 on core-updates. --Sig_/7USZMM=2pOIgMYGpWDp.Ku0 Content-Type: application/pgp-signature Content-Description: Signature digitale OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEtfrmKFtBNyiyoPrtQxEfRSAIagwFAlsK5c4ACgkQQxEfRSAI agwKLxAAnES3JvQ2FK2/4xTsyLmOo36vUG+hdk9N1+oxmuihQHXyErTyaDNWEiP3 dYVPY99+xoDPvcomeKQXd4NBVWjvwKi7VcluRZurV+Bk6VVZ3WhXKdaYKqcukot/ Txmt4fvZsHezqfs1yo4poxvy6aj/JG2cBH15UASNbEhQeGGJpu3eAG8U3mvVOP0d /1kqM3SPXMDby8vLHmAb+brj5Qrau4gouV5qdVpgMZyvx1+6HNqHqEknAJxqi747 NFm1fanxdDvob6SOQIYA/5B3HMtuYfvV6PPZBeakYywOYzuG2sOaVbwfdDSjDIzz h9fiIKShiUrIy+ylAKtw/L/lAr+2mw3OtJrSw96Ssnb1C1L/T064lqu8xKfdExde XxZsMYOBNPcvZe9R+WnyW4nAjtcdzLkzr9e/ZHI0qVZqC8fu8HcUm/kzB4feGz+a QNdp1HEEcdGAJq1fOMk+rZFgyAq33wHa2CjzMRTAEGvFPwo43zIbrUlvm8msjXz9 pKyCCIsVslPfTtpQWujmyfVIWCiflbJr2f1nz1yeXHZFCijo2aMibMYcnPXwWOeL gZLV1gPOPaZy/fEMK/x2u2Rlvf1GS2Zgx3PX2ylu77RiOtcL/8Z1xetjBc+r9zzr eiEEdYu0bRGan7k5WlhaJt4goLLJSDDLxg/HgX6ch5IpDK4i8Cs= =vklG -----END PGP SIGNATURE----- --Sig_/7USZMM=2pOIgMYGpWDp.Ku0-- ------------=_1527440882-18155-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 22 Apr 2018 17:14:16 +0000 Received: from localhost ([127.0.0.1]:35985 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fAIZ5-0000R6-Db for submit@debbugs.gnu.org; Sun, 22 Apr 2018 13:14:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58755) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fAIZ1-0000Qq-V4 for submit@debbugs.gnu.org; Sun, 22 Apr 2018 13:14:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fAIYt-00030F-Sd for submit@debbugs.gnu.org; Sun, 22 Apr 2018 13:14:06 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58493) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fAIYt-0002zs-Lm for submit@debbugs.gnu.org; Sun, 22 Apr 2018 13:14:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fAIYq-0006Zs-Hq for guix-patches@gnu.org; Sun, 22 Apr 2018 13:14:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fAIYl-0002ux-Fj for guix-patches@gnu.org; Sun, 22 Apr 2018 13:14:00 -0400 Received: from lepiller.eu ([89.234.186.109]:44608) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fAIYk-0002sG-TZ for guix-patches@gnu.org; Sun, 22 Apr 2018 13:13:55 -0400 Received: from localhost (static-176-182-42-79.ncc.abo.bbox.fr [176.182.42.79]) by lepiller.eu (OpenSMTPD) with ESMTPSA id adca38a5 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Sun, 22 Apr 2018 17:17:05 +0000 (UTC) Date: Sun, 22 Apr 2018 19:13:45 +0200 From: Julien Lepiller To: guix-patches@gnu.org Subject: Make alsa find its plugins Message-ID: <20180422191345.1836dc69@lepiller.eu> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/WQQTEAstTmd7h2.5a/7YZW9" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --MP_/WQQTEAstTmd7h2.5a/7YZW9 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, this patch adds an environment variable, ALSA_PLUGIN_DIR to allow it to find its plugins. This is especially useful in GuixSD where pulseaudio is used by most applications. When running an application that only knows about alsa, no sound can be output because the card is taken by pulse. One solution is to use the pulseaudio plugin from alsa-plugins:pulseaudio and setting ~/.asoundrc: # Default to PulseAudio pcm.!default { type pulse hint { show on description "Default ALSA Output (currently PulseAudio Sound Server)" } } ctl.!default { type pulse } But this results in an error because alsa will look for plugins in its own output directory in the store. With this patch, alsa is able to find its plugins in ALSA_PLUGIN_DIR after exporting it (export ALSA_PLUGIN_DIR=$HOME/.guix-profile/lib/alsa-lib). --MP_/WQQTEAstTmd7h2.5a/7YZW9 Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-gnu-Make-alsa-find-its-plugins-by-setting-ALSA_PLUGI.patch >From 83602af1382c6cfed7824e7931fc54bf66d688e0 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Sun, 22 Apr 2018 19:05:30 +0200 Subject: [PATCH] gnu: Make alsa find its plugins by setting ALSA_PLUGIN_DIR. * gnu/packages/patches/alsa-lib-add-environment-variable.patch: New file. * gnu/packages/linux.scm (alsa-lib)[source]: Use it. [native-search-paths]: Add ALSA_PLUGIN_DIR. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/linux.scm | 9 +- .../alsa-lib-add-environment-variable.patch | 506 ++++++++++++++++++ 3 files changed, 515 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/alsa-lib-add-environment-variable.patch diff --git a/gnu/local.mk b/gnu/local.mk index 056a46cb7..efbf36ac3 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -557,6 +557,7 @@ dist_patch_DATA = \ %D%/packages/patches/aegis-test-fixup-1.patch \ %D%/packages/patches/aegis-test-fixup-2.patch \ %D%/packages/patches/agg-am_c_prototype.patch \ + %D%/packages/patches/alas-lib-add-environment-variable.patch \ %D%/packages/patches/ansible-wrap-program-hack.patch \ %D%/packages/patches/antiword-CVE-2014-8123.patch \ %D%/packages/patches/antlr3-3_1-fix-java8-compilation.patch \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 1d9585e7f..75a8db04e 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -1002,8 +1002,15 @@ intercept and print the system calls executed by the program.") version ".tar.bz2")) (sha256 (base32 - "1rhacnlj0grvfagjx5qzsnbhw7m7lyccghqs4jsv0dnsqv9qmxpl")))) + "1rhacnlj0grvfagjx5qzsnbhw7m7lyccghqs4jsv0dnsqv9qmxpl")) + (patches (search-patches "alsa-lib-add-environment-variable.patch")))) (build-system gnu-build-system) + (native-search-paths + (list (search-path-specification + (variable "ALSA_PLUGIN_DIR") + (file-type 'regular) + (separator #f) ;single entry + (files '("lib/alsa-lib"))))) (home-page "https://www.alsa-project.org/") (synopsis "The Advanced Linux Sound Architecture libraries") (description diff --git a/gnu/packages/patches/alsa-lib-add-environment-variable.patch b/gnu/packages/patches/alsa-lib-add-environment-variable.patch new file mode 100644 index 000000000..d3e1b2859 --- /dev/null +++ b/gnu/packages/patches/alsa-lib-add-environment-variable.patch @@ -0,0 +1,506 @@ +From ef87a17bd2a55dd3247a6ee0a463f3589fc01f08 Mon Sep 17 00:00:00 2001 +From: Julien Lepiller +Date: Sun, 22 Apr 2018 16:28:38 +0200 +Subject: [PATCH] Add support for a ALSA_PLUGIN_DIR environment variable. + +If it is not set, default to previous behavior. +--- + ...a-ALSA_PLUGIN_DIR-environment-variab.patch | 378 ++++++++++++++++++ + src/control/control.c | 8 +- + src/dlmisc.c | 13 +- + src/pcm/pcm.c | 8 +- + src/pcm/pcm_rate.c | 13 +- + 5 files changed, 409 insertions(+), 11 deletions(-) + create mode 100644 0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch + +diff --git a/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch b/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch +new file mode 100644 +index 0000000..7aa6891 +--- /dev/null ++++ b/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch +@@ -0,0 +1,378 @@ ++From 54530c486c9cbf48cbb591d3428075cee9678314 Mon Sep 17 00:00:00 2001 ++From: Julien Lepiller ++Date: Sun, 22 Apr 2018 16:28:38 +0200 ++Subject: [PATCH] Add support for a ALSA_PLUGIN_DIR environment variable. ++ ++If it is not set, default to previous behavior. ++--- ++ ...a-ALSA_PLUGIN_DIR-environment-variab.patch | 249 ++++++++++++++++++ ++ src/control/control.c | 8 +- ++ src/dlmisc.c | 14 +- ++ src/pcm/pcm.c | 8 +- ++ src/pcm/pcm_rate.c | 13 +- ++ 5 files changed, 281 insertions(+), 11 deletions(-) ++ create mode 100644 0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch ++ ++diff --git a/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch b/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch ++new file mode 100644 ++index 0000000..e98acc7 ++--- /dev/null +++++ b/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch ++@@ -0,0 +1,249 @@ +++From f00f0a2e8b9b56114eb6d168d5a22d84a61ecf22 Mon Sep 17 00:00:00 2001 +++From: Julien Lepiller +++Date: Sun, 22 Apr 2018 16:28:38 +0200 +++Subject: [PATCH] Add support for a ALSA_PLUGIN_DIR environment variable. +++ +++If it is not set, default to previous behavior. +++--- +++ ...a-ALSA_PLUGIN_DIR-environment-variab.patch | 120 ++++++++++++++++++ +++ src/control/control.c | 8 +- +++ src/dlmisc.c | 14 +- +++ src/pcm/pcm.c | 8 +- +++ src/pcm/pcm_rate.c | 13 +- +++ 5 files changed, 152 insertions(+), 11 deletions(-) +++ create mode 100644 0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch +++ +++diff --git a/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch b/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch +++new file mode 100644 +++index 0000000..23ace65 +++--- /dev/null ++++++ b/0001-Add-support-for-a-ALSA_PLUGIN_DIR-environment-variab.patch +++@@ -0,0 +1,120 @@ ++++From 21e72ff81167f0ec4e4b9b56ac4af546de83557b Mon Sep 17 00:00:00 2001 ++++From: Julien Lepiller ++++Date: Sun, 22 Apr 2018 16:28:38 +0200 ++++Subject: [PATCH] Add support for a ALSA_PLUGIN_DIR environment variable. ++++ ++++If it is not set, default to previous behavior. ++++--- ++++ src/control/control.c | 8 ++++++-- ++++ src/dlmisc.c | 14 +++++++++++--- ++++ src/pcm/pcm.c | 8 ++++++-- ++++ src/pcm/pcm_rate.c | 12 ++++++++---- ++++ 4 files changed, 31 insertions(+), 11 deletions(-) ++++ ++++diff --git a/src/control/control.c b/src/control/control.c ++++index 268c5e9..b2c8f9f 100644 ++++--- a/src/control/control.c +++++++ b/src/control/control.c ++++@@ -1331,13 +1331,17 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, ++++ build_in++; ++++ } ++++ if (*build_in == NULL) { ++++- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); +++++ char* plugdir = ALSA_PLUGIN_DIR; +++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++++ if(envplugdir != NULL) +++++ plugdir = envplugdir; +++++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); ++++ if (buf1 == NULL) { ++++ err = -ENOMEM; ++++ goto _err; ++++ } ++++ lib = buf1; ++++- sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str); +++++ sprintf(buf1, "%s/libasound_module_ctl_%s.so", plugdir, str); ++++ } ++++ } ++++ #ifndef PIC ++++diff --git a/src/dlmisc.c b/src/dlmisc.c ++++index b36c48f..baa4bf8 100644 ++++--- a/src/dlmisc.c +++++++ b/src/dlmisc.c ++++@@ -76,10 +76,18 @@ void *snd_dlopen(const char *name, int mode) ++++ char *filename; ++++ ++++ if (name && name[0] != '/') { +++++ char* plugdir = ALSA_PLUGIN_DIR; +++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++++ if(envplugdir != NULL) +++++ plugdir = envplugdir; +++++ ++++ filename = malloc(sizeof(ALSA_PLUGIN_DIR) + 1 + strlen(name) + 1); ++++- strcpy(filename, ALSA_PLUGIN_DIR); ++++- strcat(filename, "/"); ++++- strcat(filename, name); +++++ if (filename == NULL) { +++++ err = -ENOMEM; +++++ return NULL; +++++ } +++++ +++++ sprintf(filename, "%s/%s", plugdir, name); ++++ handle = dlopen(filename, mode); ++++ free(filename); ++++ } ++++diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c ++++index fc7bd52..1a64490 100644 ++++--- a/src/pcm/pcm.c +++++++ b/src/pcm/pcm.c ++++@@ -2432,13 +2432,17 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, ++++ build_in++; ++++ } ++++ if (*build_in == NULL) { ++++- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); +++++ char* plugdir = ALSA_PLUGIN_DIR; +++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++++ if(envplugdir != NULL) +++++ plugdir = envplugdir; +++++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); ++++ if (buf1 == NULL) { ++++ err = -ENOMEM; ++++ goto _err; ++++ } ++++ lib = buf1; ++++- sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str); +++++ sprintf(buf1, "%s/libasound_module_pcm_%s.so", plugdir, str); ++++ } ++++ } ++++ #ifndef PIC ++++diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c ++++index f60b0ae..2c62842 100644 ++++--- a/src/pcm/pcm_rate.c +++++++ b/src/pcm/pcm_rate.c ++++@@ -1260,7 +1260,7 @@ static const char *const default_rate_plugins[] = { ++++ ++++ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_config_t *converter_conf, int verbose) ++++ { ++++- char open_name[64], open_conf_name[64], lib_name[128], *lib = NULL; +++++ char open_name[64], open_conf_name[64], *lib = NULL; ++++ snd_pcm_rate_open_func_t open_func; ++++ snd_pcm_rate_open_conf_func_t open_conf_func; ++++ int err; ++++@@ -1268,9 +1268,13 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf ++++ snprintf(open_name, sizeof(open_name), "_snd_pcm_rate_%s_open", type); ++++ snprintf(open_conf_name, sizeof(open_conf_name), "_snd_pcm_rate_%s_open_conf", type); ++++ if (!is_builtin_plugin(type)) { ++++- snprintf(lib_name, sizeof(lib_name), ++++- "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type); ++++- lib = lib_name; +++++ char* plugdir = ALSA_PLUGIN_DIR; +++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++++ if(envplugdir != NULL) +++++ plugdir = envplugdir; +++++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); +++++ sprintf(buf1, "%s/libasound_module_rate_%s.so", plugdir, type); +++++ lib = buf1; ++++ } ++++ ++++ rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; ++++-- ++++2.17.0 ++++ +++diff --git a/src/control/control.c b/src/control/control.c +++index 268c5e9..b2c8f9f 100644 +++--- a/src/control/control.c ++++++ b/src/control/control.c +++@@ -1331,13 +1331,17 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, +++ build_in++; +++ } +++ if (*build_in == NULL) { +++- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); ++++ char* plugdir = ALSA_PLUGIN_DIR; ++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++++ if(envplugdir != NULL) ++++ plugdir = envplugdir; ++++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); +++ if (buf1 == NULL) { +++ err = -ENOMEM; +++ goto _err; +++ } +++ lib = buf1; +++- sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str); ++++ sprintf(buf1, "%s/libasound_module_ctl_%s.so", plugdir, str); +++ } +++ } +++ #ifndef PIC +++diff --git a/src/dlmisc.c b/src/dlmisc.c +++index b36c48f..baa4bf8 100644 +++--- a/src/dlmisc.c ++++++ b/src/dlmisc.c +++@@ -76,10 +76,18 @@ void *snd_dlopen(const char *name, int mode) +++ char *filename; +++ +++ if (name && name[0] != '/') { ++++ char* plugdir = ALSA_PLUGIN_DIR; ++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++++ if(envplugdir != NULL) ++++ plugdir = envplugdir; ++++ +++ filename = malloc(sizeof(ALSA_PLUGIN_DIR) + 1 + strlen(name) + 1); +++- strcpy(filename, ALSA_PLUGIN_DIR); +++- strcat(filename, "/"); +++- strcat(filename, name); ++++ if (filename == NULL) { ++++ err = -ENOMEM; ++++ return NULL; ++++ } ++++ ++++ sprintf(filename, "%s/%s", plugdir, name); +++ handle = dlopen(filename, mode); +++ free(filename); +++ } +++diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c +++index fc7bd52..1a64490 100644 +++--- a/src/pcm/pcm.c ++++++ b/src/pcm/pcm.c +++@@ -2432,13 +2432,17 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, +++ build_in++; +++ } +++ if (*build_in == NULL) { +++- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); ++++ char* plugdir = ALSA_PLUGIN_DIR; ++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++++ if(envplugdir != NULL) ++++ plugdir = envplugdir; ++++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); +++ if (buf1 == NULL) { +++ err = -ENOMEM; +++ goto _err; +++ } +++ lib = buf1; +++- sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str); ++++ sprintf(buf1, "%s/libasound_module_pcm_%s.so", plugdir, str); +++ } +++ } +++ #ifndef PIC +++diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c +++index f60b0ae..72a1723 100644 +++--- a/src/pcm/pcm_rate.c ++++++ b/src/pcm/pcm_rate.c +++@@ -1260,7 +1260,8 @@ static const char *const default_rate_plugins[] = { +++ +++ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_config_t *converter_conf, int verbose) +++ { +++- char open_name[64], open_conf_name[64], lib_name[128], *lib = NULL; ++++ char open_name[64], open_conf_name[64], *lib = NULL; ++++ char *buf1; +++ snd_pcm_rate_open_func_t open_func; +++ snd_pcm_rate_open_conf_func_t open_conf_func; +++ int err; +++@@ -1268,9 +1269,13 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf +++ snprintf(open_name, sizeof(open_name), "_snd_pcm_rate_%s_open", type); +++ snprintf(open_conf_name, sizeof(open_conf_name), "_snd_pcm_rate_%s_open_conf", type); +++ if (!is_builtin_plugin(type)) { +++- snprintf(lib_name, sizeof(lib_name), +++- "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type); +++- lib = lib_name; ++++ char* plugdir = ALSA_PLUGIN_DIR; ++++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++++ if(envplugdir != NULL) ++++ plugdir = envplugdir; ++++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); ++++ sprintf(buf1, "%s/libasound_module_rate_%s.so", plugdir, type); ++++ lib = buf1; +++ } +++ +++ rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; +++-- +++2.17.0 +++ ++diff --git a/src/control/control.c b/src/control/control.c ++index 268c5e9..b2c8f9f 100644 ++--- a/src/control/control.c +++++ b/src/control/control.c ++@@ -1331,13 +1331,17 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, ++ build_in++; ++ } ++ if (*build_in == NULL) { ++- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); +++ char* plugdir = ALSA_PLUGIN_DIR; +++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++ if(envplugdir != NULL) +++ plugdir = envplugdir; +++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); ++ if (buf1 == NULL) { ++ err = -ENOMEM; ++ goto _err; ++ } ++ lib = buf1; ++- sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str); +++ sprintf(buf1, "%s/libasound_module_ctl_%s.so", plugdir, str); ++ } ++ } ++ #ifndef PIC ++diff --git a/src/dlmisc.c b/src/dlmisc.c ++index b36c48f..baa4bf8 100644 ++--- a/src/dlmisc.c +++++ b/src/dlmisc.c ++@@ -76,10 +76,18 @@ void *snd_dlopen(const char *name, int mode) ++ char *filename; ++ ++ if (name && name[0] != '/') { +++ char* plugdir = ALSA_PLUGIN_DIR; +++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++ if(envplugdir != NULL) +++ plugdir = envplugdir; +++ ++ filename = malloc(sizeof(ALSA_PLUGIN_DIR) + 1 + strlen(name) + 1); ++- strcpy(filename, ALSA_PLUGIN_DIR); ++- strcat(filename, "/"); ++- strcat(filename, name); +++ if (filename == NULL) { +++ err = -ENOMEM; +++ return NULL; +++ } +++ +++ sprintf(filename, "%s/%s", plugdir, name); ++ handle = dlopen(filename, mode); ++ free(filename); ++ } ++diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c ++index fc7bd52..1a64490 100644 ++--- a/src/pcm/pcm.c +++++ b/src/pcm/pcm.c ++@@ -2432,13 +2432,17 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, ++ build_in++; ++ } ++ if (*build_in == NULL) { ++- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); +++ char* plugdir = ALSA_PLUGIN_DIR; +++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++ if(envplugdir != NULL) +++ plugdir = envplugdir; +++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); ++ if (buf1 == NULL) { ++ err = -ENOMEM; ++ goto _err; ++ } ++ lib = buf1; ++- sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str); +++ sprintf(buf1, "%s/libasound_module_pcm_%s.so", plugdir, str); ++ } ++ } ++ #ifndef PIC ++diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c ++index f60b0ae..4bc9006 100644 ++--- a/src/pcm/pcm_rate.c +++++ b/src/pcm/pcm_rate.c ++@@ -1260,7 +1260,8 @@ static const char *const default_rate_plugins[] = { ++ ++ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_config_t *converter_conf, int verbose) ++ { ++- char open_name[64], open_conf_name[64], lib_name[128], *lib = NULL; +++ char open_name[64], open_conf_name[64], *lib = NULL; +++ char *buf1; ++ snd_pcm_rate_open_func_t open_func; ++ snd_pcm_rate_open_conf_func_t open_conf_func; ++ int err; ++@@ -1268,9 +1269,13 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf ++ snprintf(open_name, sizeof(open_name), "_snd_pcm_rate_%s_open", type); ++ snprintf(open_conf_name, sizeof(open_conf_name), "_snd_pcm_rate_%s_open_conf", type); ++ if (!is_builtin_plugin(type)) { ++- snprintf(lib_name, sizeof(lib_name), ++- "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type); ++- lib = lib_name; +++ char* plugdir = ALSA_PLUGIN_DIR; +++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); +++ if(envplugdir != NULL) +++ plugdir = envplugdir; +++ buf1 = malloc(strlen(type) + strlen(plugdir) + 32); +++ sprintf(buf1, "%s/libasound_module_rate_%s.so", plugdir, type); +++ lib = buf1; ++ } ++ ++ rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; ++-- ++2.17.0 ++ +diff --git a/src/control/control.c b/src/control/control.c +index 268c5e9..b2c8f9f 100644 +--- a/src/control/control.c ++++ b/src/control/control.c +@@ -1331,13 +1331,17 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, + build_in++; + } + if (*build_in == NULL) { +- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); ++ char* plugdir = ALSA_PLUGIN_DIR; ++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++ if(envplugdir != NULL) ++ plugdir = envplugdir; ++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); + if (buf1 == NULL) { + err = -ENOMEM; + goto _err; + } + lib = buf1; +- sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str); ++ sprintf(buf1, "%s/libasound_module_ctl_%s.so", plugdir, str); + } + } + #ifndef PIC +diff --git a/src/dlmisc.c b/src/dlmisc.c +index b36c48f..f6af8fe 100644 +--- a/src/dlmisc.c ++++ b/src/dlmisc.c +@@ -76,10 +76,17 @@ void *snd_dlopen(const char *name, int mode) + char *filename; + + if (name && name[0] != '/') { ++ char* plugdir = ALSA_PLUGIN_DIR; ++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++ if(envplugdir != NULL) ++ plugdir = envplugdir; ++ + filename = malloc(sizeof(ALSA_PLUGIN_DIR) + 1 + strlen(name) + 1); +- strcpy(filename, ALSA_PLUGIN_DIR); +- strcat(filename, "/"); +- strcat(filename, name); ++ if (filename == NULL) { ++ return NULL; ++ } ++ ++ sprintf(filename, "%s/%s", plugdir, name); + handle = dlopen(filename, mode); + free(filename); + } +diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c +index fc7bd52..1a64490 100644 +--- a/src/pcm/pcm.c ++++ b/src/pcm/pcm.c +@@ -2432,13 +2432,17 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, + build_in++; + } + if (*build_in == NULL) { +- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32); ++ char* plugdir = ALSA_PLUGIN_DIR; ++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++ if(envplugdir != NULL) ++ plugdir = envplugdir; ++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32); + if (buf1 == NULL) { + err = -ENOMEM; + goto _err; + } + lib = buf1; +- sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str); ++ sprintf(buf1, "%s/libasound_module_pcm_%s.so", plugdir, str); + } + } + #ifndef PIC +diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c +index f60b0ae..4bc9006 100644 +--- a/src/pcm/pcm_rate.c ++++ b/src/pcm/pcm_rate.c +@@ -1260,7 +1260,8 @@ static const char *const default_rate_plugins[] = { + + static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_config_t *converter_conf, int verbose) + { +- char open_name[64], open_conf_name[64], lib_name[128], *lib = NULL; ++ char open_name[64], open_conf_name[64], *lib = NULL; ++ char *buf1; + snd_pcm_rate_open_func_t open_func; + snd_pcm_rate_open_conf_func_t open_conf_func; + int err; +@@ -1268,9 +1269,13 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf + snprintf(open_name, sizeof(open_name), "_snd_pcm_rate_%s_open", type); + snprintf(open_conf_name, sizeof(open_conf_name), "_snd_pcm_rate_%s_open_conf", type); + if (!is_builtin_plugin(type)) { +- snprintf(lib_name, sizeof(lib_name), +- "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type); +- lib = lib_name; ++ char* plugdir = ALSA_PLUGIN_DIR; ++ char* envplugdir = getenv("ALSA_PLUGIN_DIR"); ++ if(envplugdir != NULL) ++ plugdir = envplugdir; ++ buf1 = malloc(strlen(type) + strlen(plugdir) + 32); ++ sprintf(buf1, "%s/libasound_module_rate_%s.so", plugdir, type); ++ lib = buf1; + } + + rate->rate_min = SND_PCM_PLUGIN_RATE_MIN; +-- +2.17.0 + -- 2.17.0 --MP_/WQQTEAstTmd7h2.5a/7YZW9-- ------------=_1527440882-18155-1--