Am Sa, Nov 30, 2024 am 10:19:11 +0000 schrieb Laurent Bercot:
> > $ cat /etc/s6/sv/alsa/up
> > #!/bin/execlineb -P
> > if -t { test -e /var/lib/alsa/asound.state }
> > fdmove -c 2 1
> > exec alsactl restore
>
> [snip]
> - Your up script is behaving differently depending on whether the
>result of the test is true or false. The "alsactl restore" command
>may or may not be called, depending on an external property (whether
>the asound.state file exists or not). This means that your machine
>state after boot is not guaranteed; this is generally a bad idea.
Sure, but what if the “alsactl restore” command depends on
/var/lib/alsa/asound.state existing to run properly? Although this adds a race
condition to the script, it seems better to me than using “foreground { … }”
because one may not want to ignore all errors that may be raised by the
command.
Hoël
Received on Sat Nov 30 2024 - 12:59:43 CET