Skip to contentSkip to conversation

alsatplg broken with musl-libc

DISCUSSION GitHub issues - opened 1 participant 1 message Nov 1, 2021 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

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.

Quoted 1 line

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