Hi Valentin,
On Tue, Nov 18, 2025 at 03:06:28PM +0100, Erik Auerswald wrote:
> On Tue, Nov 18, 2025 at 02:09:40PM +0100, Valentin Haudiquet wrote:
> > [...]
> > However, I recall from our previous conversations that you would
> > not want to implement such a filter because of possible breaks on
> > non-GNU systems, right?
>
> I do not want to break the currently working functionality for systems
> with a /var/run/utmp file. I do not like the idea of suppressing a
> legitimate error message on those systems just because a newer system
> introduces them as a side effect of normal operation. As such I'd
> prefer to filter entries without an existing TTY from the results
> returned from this new system, but not from the existing one.
>
> Using "configure --enable-systemd" looks like an easy way for GNU
> Inetutils to support user messaging on the newer systems. It would
> be great if that just worked, but it doesn't.
I may have found a small change to adjust user messaging to a system
without "utmp" file when using "--enable-systemd". I think that
"configure" prefers to use a "utmp" file if possible, and only falls
back to non-utmp compatibility if there is none.
On my Ubuntu 22.04 system, which still has a "utmp" file,
"READUTMP_USE_SYSTEMD" is never defined:
$ ./configure
[...]
$ grep SYSTEMD config.{status,h}
config.status:S["SYSTEMD_CHOICE"]="no"
config.h:/* #undef READUTMP_USE_SYSTEMD */
$ ./configure --enable-systemd
[...]
$ grep SYSTEMD config.{status,h}
config.status:S["SYSTEMD_CHOICE"]="yes"
config.h:/* #undef READUTMP_USE_SYSTEMD */
How does this look on the development version of Ubuntu 26.04? I would
expect that "READUTMP_USE_SYSTEMD" is defined with "--enable-systemd"
there, but not without. Could you test this and report back?
If this idea is correct, then the attached patch should result in passing
"syslogd.sh" and "utmp.sh" tests on the development version of Ubuntu
26.04 when "./configure --enable-systemd" is used. If this works for
"syslogd", then this could also work for "talkd", but have neither tested
nor looked into "talkd" yet.
Could you try the attached patch and report back? The "syslogd" test
should pass with and without "VERBOSE=1", and if the test user is logged
into a Linux virtual console, e.g., tty3, then the test send messages
there with "VERBOSE=1". There should not be any unexpected error messages
regarding not existing files.
Thanks,
Erik
diff --git a/libinetutils/ttymsg.c b/libinetutils/ttymsg.c
index 74d73167..a4f17d4a 100644
--- a/libinetutils/ttymsg.c
+++ b/libinetutils/ttymsg.c
@@ -109,6 +109,10 @@ inetutils_ttymsg (struct iovec *iov, int iovcnt, char *line, int tmout)
{
if (errno == EBUSY || errno == EACCES)
return (NULL);
+#ifdef READUTMP_USE_SYSTEMD
+ if (errno == ENOENT)
+ return (NULL);
+#endif
snprintf (errbuf, sizeof (errbuf), "%s: %s", device, strerror (errno));
free (device);
return errbuf;