Collin Funk <[email protected]> writes: > Paul Eggert <[email protected]> writes: > >> On 2026-04-18 15:40, Arsen Arsenović wrote: >>> Paul Eggert <[email protected]> writes: >>> >>>> On 2026-04-18 11:29, Collin Funk wrote: >>>> >>>>> The issue I have with this solution is that it requires the 'who' >>>>> program to maintain an ever expanding list of user names used by desktop >>>>> managers. >>>> >>>> Maybe filter them out if their login shell ends in "/nologin"? >>>> >>>>> Also, I guess this is mostly theoretical, but you would want to show >>>>> 'gdm-greeter' if a user actually named themselves that. >>>> >>>> The "/nologin" hack should work in that weird case. >>> Why not check for class == user? >> >> Oh, I never knew about sd_session_get_class. Yes, it sounds like >> Gnulib's readutmp.c should use this function to filter out bogus >> entries. >> >> >> >>> There's clearly already attempts to do this in the code, so it's worth >>> debugging what goes wrong there. Sorry if I'm missing something >>> obvious. >> >> Currently the Gnulib code checks only for class being "manager". I >> wonder why it does that? Anyway, it appears that 'who' should output >> only "user" entries. > > Looking at this snippet of code: > > if (seat != NULL) > a = add_utmp (a, options, > user, strlen (user), > session, strlen (session), > seat, strlen (seat), > host, strlen (host), > leader_pid /* the best we have */, > ctype, start_ts, leader_pid, 0, 0); > if (tty != NULL) > a = add_utmp (a, options, > user, strlen (user), > session, strlen (session), > tty, strlen (tty), > host, strlen (host), > leader_pid /* the best we have */, > ctype, start_ts, leader_pid, 0, 0); > > I'm not very familiar with the concept of seats. Could we just check the > entry following each seat to see if it has a user entry associated with > it? If it does, skip printing the seat? Something like this: > > for each utmp_entry: > if utmp_entry[0] == "seat" and utmp_entry[1] == "user": > # Don't print the seat if we have a user. > continue > print (utmp_entry[0]) > > Collin
I'm not sure why seats would be considered separate sessions for the purposes of 'who'. They aren't sessions. https://www.freedesktop.org/software/systemd/man/latest/sd-login.html#seat -- Arsen Arsenović
signature.asc
Description: PGP signature
