On Wed, Jul 23, 2025 at 10:31:47PM +0100, Andrew Bower wrote:
On Mon, Jun 30, 2025 at 11:36:59PM +0100, Andrew Bower wrote:[...]
1. Unitialised 'sessions' variable is a a bug on all systems which leads
to a segfault on some. I'm now tagging this bug as having a patch.
2. elogind not being queried. Is this an elogind issue? Should it give a
different answer to sd_booted() or is this the wrong way to detect the
seat management capability? 'who' does not have this problem - it
somehow queries elogind anyway.
procps then resorts to utmp.
3. Some (vc) sessions not reported unless running as root, but the non-root
user could read utmp. 'who' does not have this problem but then it
probably didn't resort to reading utmp (see 2 above).
On Thu, Jul 24, 2025 at 07:15:12PM +0100, Andrew Bower wrote:
On Wed, Jul 23, 2025 at 10:31:47PM +0100, Andrew Bower wrote:
On Mon, Jun 30, 2025 at 11:36:59PM +0100, Andrew Bower wrote:[...]
1. Unitialised 'sessions' variable is a a bug on all systems which leads
to a segfault on some. I'm now tagging this bug as having a patch.
In the absence of any other fixes, my patch for this still stands.
But...
2. elogind not being queried. Is this an elogind issue? Should it give a
different answer to sd_booted() or is this the wrong way to detect the
seat management capability? 'who' does not have this problem - it
somehow queries elogind anyway.
Removing the call to sd_booted() and just using the result of sd_get_sessions() is sufficient. I get the correct outcome in this case.
Unfortunately we don't then get any runtime fallback to utmp but my
guess is working elogind support would be preferred (and should be fixed
for trixie).
I am not proposing a patch here because it needs attention from someone
more familiar with the relevant components.
My hunch is that the best plan for trixie is to go straight to calling sd_get_sessions() and not testing sd_booted(). This would then supersede
the patch for (1).
I think we should do this:
Remove sd_booted() check
if sd_get_sessions()
< 0 && != ENOENT: error
> 0: show sessions
default: fallback to utmp
This should deal with:
1. systemd and elogind with some login sessions: show sessions
2. neither systemd nor elogind: fallback to utmp reading
3. systemd and elogind with no sessions: show nothing, as now, but via
fallback utmp route with no practical difference.
I don't see a downside from this approach.
On Mon, 28 Jul 2025 at 17:31, Andrew Bower <andrew@bower.uk> wrote:
I think we should do this:
Remove sd_booted() check
if sd_get_sessions()
< 0 && != ENOENT: error
> 0: show sessions
default: fallback to utmp
This should deal with:
1. systemd and elogind with some login sessions: show sessions
2. neither systemd nor elogind: fallback to utmp reading
3. systemd and elogind with no sessions: show nothing, as now, but via
fallback utmp route with no practical difference.
I don't see a downside from this approach.
I think this is the correct way too. I'll double check that 0 user path because
it looks odd, but its probably doing the right thing.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 146:10:07 |
Calls: | 10,383 |
Calls today: | 8 |
Files: | 14,054 |
D/L today: |
2 files (1,861K bytes) |
Messages: | 6,417,699 |