[Pkg-alsa-devel] Bug#549531: libasound2: snd_device_name_hint() wrongly calls snd_config_delete()

John Lindgren john.lindgren at tds.net
Sun Oct 4 00:34:44 UTC 2009


Package: libasound2
Version: 1.0.21a-1
Severity: normal
Tags: patch

Symptoms
--------

This bug first showed up because of a new ALSA output plugin for
Audacious audio player:

        http://jira.atheme.org/browse/AUDPLUG-77#action_10640
        
Essentially, any call to snd_device_name_hint() causes later calls to
snd_pcm_open() to fail with messages like these:

        ALSA lib conf.c:4600:(snd_config_expand) Unknown parameters CARD=Live,DEV=0 
        ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM rear:CARD=Live,DEV=0

This happens only for PCMs defined in ALSA config files (such as the
ones under /usr/share/alsa/cards), not for "default" or "hw:0,0"-style.
It does not seem to depend on a particular sound card. It can be
reproduced without Audacious by adding a call to pcm_list() before the
call to snd_pcm_open() in aplay.c from the alsa-utils package:

        $ ./aplay -D front:CARD=ICH6,DEV=0 Test.wav
        default:CARD=ICH6
            Intel ICH6, Intel ICH6
            Default Audio Device
        front:CARD=ICH6,DEV=0
            Intel ICH6, Intel ICH6
            Front speakers
        surround40:CARD=ICH6,DEV=0
            Intel ICH6, Intel ICH6
            4.0 Surround output to Front and Rear speakers
        surround41:CARD=ICH6,DEV=0
            Intel ICH6, Intel ICH6
            4.1 Surround output to Front, Rear and Subwoofer speakers
        surround50:CARD=ICH6,DEV=0
            Intel ICH6, Intel ICH6
            5.0 Surround output to Front, Center and Rear speakers
        surround51:CARD=ICH6,DEV=0
            Intel ICH6, Intel ICH6
            5.1 Surround output to Front, Center, Rear and Subwoofer speakers
        iec958:CARD=ICH6,DEV=0
            Intel ICH6, Intel ICH6 - IEC958
            IEC958 (S/PDIF) Digital Audio Output
        null
            Discard all samples (playback) or generate zero samples (capture)
        ALSA lib conf.c:4600:(snd_config_expand) Unknown parameters CARD=ICH6,DEV=0
        ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM front:CARD=ICH6,DEV=0
        aplay: main:610: audio open error: Invalid argument
        
Diagnosis
---------

try_config(), called by snd_device_name_hint(), calls
snd_config_search_definition() at namehint.c line 243 and
snd_config_search_alias_hooks() at line 339, then calls
snd_config_delete() on the returned nodes at lines 331 and 383.  This
was probably meant to prevent leaking memory returned by the search
functions, but in fact it removes information from the config that is
needed by later calls, such as snd_pcm_open.  Hence, snd_pcm_open
behaves as though devices like "front" and "rear" do not exist.

I have attached a patch for aplay.c to reproduce the problem and a patch
for namehint.c to fix it.  One side effect of the fix (on my system at
least) is that two "null" devices are now listed by "aplay -L" and in
Audacious.

Peace,
John Lindgren


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libasound2 depends on:
ii  libc6                         2.9-25     GNU C Library: Shared libraries

libasound2 recommends no packages.

Versions of packages libasound2 suggests:
pn  libasound2-plugins            <none>     (no description available)

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aplay.c.diff
Type: text/x-patch
Size: 288 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-alsa-devel/attachments/20091003/7f98f1b6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: namehint.c.diff
Type: text/x-patch
Size: 517 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-alsa-devel/attachments/20091003/7f98f1b6/attachment-0001.bin>


More information about the Pkg-alsa-devel mailing list