Comment 2 for bug 268780

Revision history for this message
Zakhar (alainb06) wrote :

After a few time of reflexion, here are my comments / suggestions about this bug.

Who seems to be mainly a frontend to display nicely the informations in /var/run/utmp (or /var/log/wtmp for the history).
The documentation says that these files, unfortunately (because it's not vey good architecture) are used by several other parts of Linux and shouldn't be changed.

As it is not wise to change these files, or the way the informations are stored in the files (I'm not skilled enough to measure the impact of a change in these files)

First point of view can be :
-----------------------------------
- who is a "console" tool, and thus is unaware of any program using devices such as a mouse, a joypad, etc...

Such a point of view would be relevant and coherent to the "console" nature of the who command.

But then two things are to be taken into consideration if this point of view is accepted:
- the "bug" is in the documentation. Because mouses are so common, when an average person reaads "user has been idle", he is bound to think that mouse movements are taken into account. So the documentation MUST be more precise. It MUST be explicitly written that idle means only "did not touch the keyboard".
- in a script you have no way of knowing the "real" idle status of the user. I mean of course, an idle status taking into account mouse inputs or other input devices operated by the user.

For this second issue, it can be moved to the various GUI: Gnome, KDE, etc, (or X server ?) all know if their user is active or not, mouse included, screensaver proves it.
Of course it would be much better if there was an unique way to include mouse inactivity for scripts (or "real" idle status).
A unique method would allow scripting for any graphical environment.

A second point of view,
---------------------------------
although the first option is relevant, is to remember that who is only a frontend.
The workaround would then be to add an option that would call the GUI in use (or X?) and ask for details about idle timers.

For example: who -g
could call Gnome, KDE, etc... and report idle timer seen by the GUI.

This workaround has the advantage that it does not disrupt the other options or the format and feeding of /var/run/utmp, but would report more relevant informations for scripts who want to run when there is no user for some time (my initial need).

Important suggestion:
------------------------------
when you write a script that is supposed to run when there are no active users for some time (initial need) you are also interested by a "flag" all GUI (or X ?) most probably support. I'm thinking of the "do not go to screensaver" flag. Most important example is when a user is watching a movie: he doesn't want screensaver! And even if he is not touching keyboard or mouse, you can assume there is a user. So if the script is highly I/O or CPU consuming and could disrupt movie playback, you do not want to start your script.

So, if a who -g (or who -X if the information is commonly handled by the X server) is added, I would strongly recommend, as a specification to display as well such a "do not go to screensaver" flag.

And second bug:
-----------------------
has to be fixed... the second bug I pointed to for remote users has to be fixed, or checked it does not happen if we have a new option to know a better "idle" timer through X or GUI.
Because at the moment, who reports "old" for the user connected to X in remote, even if the remote user uses its keyboard.

Idle timer is also incorrectly reported by who if someone works through VNC. The VNC user is seen idle whether even when keyboard is used.