[alsa-devel] [PATCH] Emit an error message when dlopen fails.

Cedric Roux sed at free.fr
Wed Nov 22 08:45:25 CET 2017


On 11/22/2017 02:09 AM, Takashi Sakamoto wrote:
> In my opinion, this patch is preferable, however it can always generate superfluous error messages when handling hook configuration on 'alsa.conf'. For example:
> 
> $ LD_PRELOAD=./src/.libs/libasound.so.2.0.0 amixer
> ALSA lib dlmisc.c:85:(snd_dlopen) snd_dlopen: /usr/lib/x86_64-linux-gnu/alsa-lib//./src/.libs/libasound.so.2.0.0: /usr/lib/x86_64-linux-gnu/alsa-lib//./src/.libs/libasound.so.2.0.0: cannot open shared object file: No such file or directory
> ALSA lib dlmisc.c:85:(snd_dlopen) snd_dlopen: /usr/lib/x86_64-linux-gnu/alsa-lib//./src/.libs/libasound.so.2.0.0: /usr/lib/x86_64-linux-gnu/alsa-lib//./src/.libs/libasound.so.2.0.0: cannot open shared object file: No such file or directory
> ALSA lib dlmisc.c:85:(snd_dlopen) snd_dlopen: /usr/lib/x86_64-linux-gnu/alsa-lib//./src/.libs/libasound.so.2.0.0: /usr/lib/x86_64-linux-gnu/alsa-lib//./src/.libs/libasound.so.2.0.0: cannot open shared object file: No such file or directory
> ALSA lib dlmisc.c:85:(snd_dlopen) snd_dlopen: /usr/lib/x86_64-linux-gnu/alsa-lib//./src/.libs/libasound.so.2.0.0: /usr/lib/x86_64-linux-gnu/alsa-lib//./src/.libs/libasound.so.2.0.0: cannot open shared object file: No such file or directory
> ALSA lib dlmisc.c:85:(snd_dlopen) snd_dlopen: /usr/lib/x86_64-linux-gnu/alsa-lib//./src/.libs/libasound.so.2.0.0: /usr/lib/x86_64-linux-gnu/alsa-lib//./src/.libs/libasound.so.2.0.0: cannot open shared object file: No such file or directory
> ALSA lib dlmisc.c:85:(snd_dlopen) snd_dlopen: /usr/lib/x86_64-linux-gnu/alsa-lib//./src/.libs/libasound.so.2.0.0: /usr/lib/x86_64-linux-gnu/alsa-lib//./src/.libs/libasound.so.2.0.0: cannot open shared object file: No such file or directory
> Simple mixer control 'IEC958',0
>   Capabilities: pswitch pswitch-joined
>   Playback channels: Mono
>   Mono: Playback [on]
> ...
> 
> When any hook configuration includes no lines with 'lib', 'snd_dlopen()' gets NULL as its first argument, then 'dlopen()' gets an inexistent path as its first argument, like:

Ah, this is a problem.
But I struggled with the "alsaeq plugin" which, under ubuntu 17 something
is not linked against libasound and when pulseaudio is configured to use
it, it fails without saying anything useful and the hacker (me) has to spend too
much time because ALSA does not use dlerror.

> 
> (parsing alsa.conf)
> snd_config_hooks_call()
>   ->snd_dlopen(name = NULL)
>     if (name == NULL)
>       name = self
>     filename = ALSA_PLUGIN_DIR + '/' + name
>     dlopen(filename)
>     (generate the error messages)
> 
> I don't know why alsa-lib is programmed as what it is, so have no idea to suggest better solution...
> 
> Additionally, your patch includes some issues of patch format:
> * Not only your signature but also patch comment is required. The first
>   line is interpreted as patch title, and the rest is as comment.

okay, next time I'll write some text.

> * Patches should be compliant to git-patch format. I encountered failure
>   of 'git am' for this patch. Please use 'git format-patch' command to
>   generate patches for posting.

I used format-patch and imap-send. Maybe this bloated thunderbird did
mess up (I configured it as explained in the man pages).

Anyway, do what you want with the patch above, I don't really care actually.
Problem is solved on my side. I've seen messages in the wild from people
with the same problem, I thought I could help a bit. I didn't see the
"big picture" (that is: bad design of too many software).

All I know is that it's good practice to report errors to users. If
a code path can "legitimately" generate errors, then the programmer
needs to deal with it in a convenient way.

But yeah, I don't care. ALSA lib is bloated to start with.
(This email is my last, I won't troll more, promise.)

> 
> When posting patches, please take care of the above.
> 
> 
> Regards
> 
> Takashi Sakamoto



More information about the Alsa-devel mailing list