Bug#106244: [Pkg-alsa-devel] Bug#106244:

David B Harris David B Harris <dbharris@eelf.ddts.net>, 106244@bugs.debian.org
Fri, 27 Feb 2004 14:15:42 -0500

On Fri, 27 Feb 2004 10:29:15 +0100
Thomas Hood <jdthood@yahoo.co.uk> wrote:
> > - debian/postinst: If /etc/asound.state exists, copy it to /var/lib/alsa.
> The file should be moved in alsa-utils's preinst instead of in
> the postinst.  That way asound.state is in the right place as soon
> as the new alsactl is executable.  Also, only moving the file in
> preinst is consistent with un-moving it in the postrm.  See ch. 6
> of the policy manual for a description of how the maintainer scripts
> are run.

I'm familiar with the policy, but I'll admit to having a hard time
reading that section.

The problem I see with doing it in the preinst is as follows:

1. alsa-utils preinst runs, moves asound.state to /var
2. alsa-driver old postrm runs /etc/init.d/alsa stop, state gets stored
   to /etc (the old alsactl is still on-disk)
3. alsa-utils finishes unpacking
4. alsa-driver new postinst runs /etc/init.d/alsa start, mixer settings
   are restored from /var

In this situation, we see two side-effects; there is now
/etc/asound.state and /var/lib/alsa/asound.state (the first one being
the last set of saved mixer settings), and the mixer settings have been
restored from /var/lib/alsa/asound.state, so they're potentially
out-of-date (perhaps muted).

Like I said though, I do have a hard time reading and understanding that
section. I should probably go through dpkg source at some point, but I
don't have the time for it now. Is the above scenario possible?