Skip to content

Draft: Make checking for valid wtmp path optional, for musl.

alfredfo requested to merge alfredfo/accountsservice:wtmp-optional into main

Hello! This PR is just a draft on supporting musl libc. musl does not support wtmp at all and just implements it as a stub that does nothing, see https://wiki.musl-libc.org/faq.html#Q:_Why_is_the_utmp/wtmp_functionality_only_implemented_as_stubs?.

When configuring this project using "meson setup" it fails with musl because musl does not defines a path to wtmp, but my patch makes that check optional, making it work for musl.

This solution is a little hacky, because it relies on musl doing nothing and may break for other libc implementations. I think the proper way to go about it would just be to make a flag that completely disables wtmp in the project's source code and meson.build. But I am curious hearing how you would approach this.

Another solution would be to add wtmp path as a meson string variable and always use that if not null.

EDIT: added a replacement for fgetspent_r which is also needed for musl libc. See specific commit.

Edited by alfredfo

Merge request reports