Re: readutmp: load libsystemd with dlopen instead of linking

Simon Josefsson via Gnulib discussion list <[email protected]> Mon, 13 Jul 2026 13:07:04 +0200
Newsgroups gmane.comp.lib.gnulib.bugs
Message-ID <[email protected]>
Bruno Haible via Gnulib discussion list <[email protected]> writes:

> The approach looks reasonable to me. Of course, I'll also value the opinion
> of the other Gnulib and coreutils contributors.

FWIW, my opinion is that avoiding hard link-time dependencies on
anything systemd-related for things like readutmp would be good: these
binaries were often usable without anything systemd-related before, like
in a minimal container environments, and pulling in systemd only to get
readutmp functionality seems excessive to me.  It seems like a better
trade-off to just have readutmp return garbage in this scenario.

Maybe this could be up to the application?  We could have a gnulib
module 'readutmp' that works like today, but add a 'readutmp-optional'
were having the API/ABI is what's important, and having it return proper
data is secondary.  Probably readutmp() and readutmp_optional() APIs are
needed, too, for multi-application projects were two different tools
have different preferences.

There are several tools in GNU InetUtils that uses readutmp.  For
example, InetUtils syslogd uses readutmp.h.  Having the built binaries
always depend on the systemd ecosystem prevents using them in minimal
environments.  It would be nice it syslogd wouldn't a link-time
dependency on anything systemd-related.

/Simon
signature.asc (application/pgp-signature, 1.2 KB)
-----BEGIN PGP SIGNATURE-----

iQNoBAEWCgMQFiEEo8ychwudMQq61M8vUXIrCP5HRaIFAmpUxtgUHHNpbW9uQGpv
c2Vmc3Nvbi5vcmfCHCYAmDMEXJLOtBYJKwYBBAHaRw8BAQdACIcrZIvhrxDBkK9f
V+QlTmXxo2naObDuGtw58YaxlOu0JVNpbW9uIEpvc2Vmc3NvbiA8c2ltb25Aam9z
ZWZzc29uLm9yZz6IlgQTFggAPgIbAwULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgBYh
BLHSvRN1vst4TPT4xNc89jjFPAa+BQJp4fWRBQkOa+rdAAoJENc89jjFPAa+hWIA
/1lQvrJeGlQq50lP6tm99D1zDy7J1tQ3ha4x0Jx7rkFTAP9hpUKuTvm6m1fXyiZV
YZlu2+Id/Dq3CIAZvNF+XEr2BLgzBFySz4EWCSsGAQ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