alsatplg broken with musl-libc

GitHub issues - opened github at alsa-project.org
Mon Nov 1 21:48:50 CET 2021


alsa-project/alsa-lib issue #187 was opened from Johnnynator:

alsatplg feeds empty and non Integer strings to `strtol(3)` and friends. Glibc just silently accepts such inputs and does not set errno and returns 0. Musl sets `errno` to `EINVAL` with such inputs.
This can easily be seen by most of the `alsatplg` invocation when compiling https://github.com/thesofproject/sof/

`STRTOL(3)` manpage explains that this behavior is allowed.
>  The implementation may also set errno to EINVAL in case no conversion
    was performed (no digits seen, and 0 returned).

There are like two ways I see this can be fixed

a) ignore EINVAL (and check if base is correct ourself)
b) make sure that strtol is only getting called with a valid input (I'm not sure if the current behavior is intended to just return 0 if e,g, `tplg_get_unsigned` did not even parse anything valid

Issue URL     : https://github.com/alsa-project/alsa-lib/issues/187
Repository URL: https://github.com/alsa-project/alsa-lib


More information about the Alsa-devel mailing list