Hi Luca,
Thanks for the revised patch.
The approach looks reasonable to me. Of course, I'll also value the opinion
of the other Gnulib and coreutils contributors. Also, since this patch adds
complexity, I'd like to understand why approach (b) [from the other mail]
would not work.
> static int
> read_utmp_from_systemd (idx_t *n_entries, STRUCT_UTMP **utmp_buf, int
> options)
> {
> + if (load_libsystemd () < 0)
> + return -1;
> +
> /* Fill entries, simulating what a utmp file would contain. */
> struct utmp_alloc a = { NULL, 0, 0, 0 };
Here I wonder whether it would be good to write a message to stderr,
something like
_("error: functionality provided by libsystemd is not available, as
libsystemd.so is not found")
So that the user does not have to wonder how to fix the failure.
Also, what about static linking (CC="gcc -static")?
Pàdraig, does coreutils support building statically?
Does glibc support dlopen from statically linked binaries meanwhile?
> + gl_saved_LIBS="$LIBS"
> + AC_SEARCH_LIBS([dlsym], [dl],
> + [case "$ac_cv_search_dlsym" in
> + 'none required') READUTMP_LIB= ;;
> + *) READUTMP_LIB=$ac_cv_search_dlsym ;;
> + esac],
> + [gl_cv_lib_readutmp_systemd=no])
> + LIBS="$gl_saved_LIBS"
glibc >= 2.34 does not need -ldl any more. This piece of configuration
should therefore use m4/libdl.m4, so as to avoid linking with -ldl when
not needed.
Finally, for this large patch [1] we would need your copyright assignment
to the FSF [2]. I don't see one for your name (Luca Boccassi) in the records.
Maybe you are doing this job on behalf of your employer? In that case,
the FSF might need an assignment or disclaimer from your employer.
For this topic of copyright assignment, please reply to me in private email.
Bruno
[1] https://www.gnu.org/prep/maintain/html_node/Legally-Significant.html
[2] https://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html