Bug 35769 - w(1) does not correctly interpret X sessions
Summary: w(1) does not correctly interpret X sessions
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-11 10:20 UTC by Michael Wardle
Modified: 2017-12-31 22:36 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Wardle 2002-03-11 10:20:00 UTC
If I do "w" on my system, I get this output:
-----
w: /dev/:0: No such file or directory
w: /dev/air.:0: No such file or directory
 9:04PM  up 20:32, 0 users, load averages: 0.04, 0.06, 0.02
USER             TTY      FROM              LOGIN@  IDLE WHAT
-----

I guess it tries to interpret the terminal (usually something like ttyv1) as an entry in /dev, however a user can also be logged in on an X session such as :0 or remotehost:0.  These "terminals" should not
be interpreted as entries in /dev.

Running "who" on my system shows what is really happening:
-----
michael          :0      Mar 11 20:57
alison           air.:0  Mar 11 20:52
-----

I have configured this host as a remote X server, so most logins are
actually performed remotely using XDMCP, but I expect this will also
work if only a local X session is active.

How-To-Repeat: establish an X session on the host, then issue "w".
Comment 1 Crist J. Clark freebsd_committer freebsd_triage 2002-03-11 11:31:59 UTC
On Mon, Mar 11, 2002 at 02:10:17AM -0800, Michael Wardle wrote:
[snip]

> >Description:
> If I do "w" on my system, I get this output:
> -----
> w: /dev/:0: No such file or directory
> w: /dev/air.:0: No such file or directory
>  9:04PM  up 20:32, 0 users, load averages: 0.04, 0.06, 0.02
> USER             TTY      FROM              LOGIN@  IDLE WHAT
> -----
> 
> I guess it tries to interpret the terminal (usually something like ttyv1) as an entry in /dev, however a user can also be logged in on an X session such as :0 or remotehost:0.  These "terminals" should not
> be interpreted as entries in /dev.

You should bet getting the pty(4) associated with the session.

> Running "who" on my system shows what is really happening:
> -----
> michael          :0      Mar 11 20:57
> alison           air.:0  Mar 11 20:52
> -----
> 
> I have configured this host as a remote X server, so most logins are
> actually performed remotely using XDMCP, but I expect this will also
> work if only a local X session is active.

Hmmm...

  $ echo $DISPLAY
  blossom.cjclark.org:10.0
  $ tty
  /dev/ttyp3
  $ w
   3:31AM  up 33 days,  3:08, 7 users, load averages: 1.02, 1.03, 1.00
  USER             TTY      FROM              LOGIN@  IDLE WHAT
  cjc              p0       vegeta           Wed08AM     1 emacs /var/tmp/tmp_cjc/mutt-blossom-57999-1626
  cjc              p1       blossom.cjclark. Wed08AM    35 tcsh
  cjc              p2       blossom.cjclark. Wed08AM    49 tcsh

> >How-To-Repeat:
> establish an X session on the host, then issue "w".

What does 'tty' return for one of these sessions?
-- 
Crist J. Clark                     |     cjclark@alum.mit.edu
                                   |     cjclark@jhu.edu
http://people.freebsd.org/~cjc/    |     cjc@freebsd.org
Comment 2 Michael Wardle 2002-03-11 13:09:30 UTC
[...]

> What does 'tty' return for one of these sessions?

This is precisely the problem -- it is not a terminal, indeed there is
no way to issue "tty".  I can only issue "tty" if I start a terminal
emulator, but the problem is when w tries to look directly at the X
session itself, not any terminal I have spawned from within the X
session.

In the same way, I can't "write" a user on one of these X sessions
unless they have opened a terminal emulator (such as xterm or konsole).


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
Comment 3 crist.clark 2002-03-11 19:34:22 UTC
On Mon, Mar 11, 2002 at 05:09:30AM -0800, Michael Wardle wrote:
> 
> [...]
> 
> > What does 'tty' return for one of these sessions?
> 
> This is precisely the problem -- it is not a terminal, indeed there is
> no way to issue "tty".  I can only issue "tty" if I start a terminal
> emulator, but the problem is when w tries to look directly at the X
> session itself, not any terminal I have spawned from within the X
> session.

Ah. Now I realize what you are talking about. You're using
xdm(8). xdm(8) is well known for putting broken entries into
utmp(5). There isn't much w(1) can do about it. xdm(8) is feeding it
invalid data.
-- 
Crist J. Clark                     |     cjclark@alum.mit.edu
                                   |     cjclark@jhu.edu
http://people.freebsd.org/~cjc/    |     cjc@freebsd.org
Comment 4 Michael Wardle 2002-03-11 22:01:33 UTC
--- "Crist J. Clark" <crist.clark@attbi.com> wrote:
> On Mon, Mar 11, 2002 at 05:09:30AM -0800, Michael Wardle wrote:
> > 
> > [...]
> > 
> > > What does 'tty' return for one of these sessions?
> > 
> > This is precisely the problem -- it is not a terminal...

[...]

> Ah. Now I realize what you are talking about. You're using
> xdm(8). xdm(8) is well known for putting broken entries into
> utmp(5). There isn't much w(1) can do about it. xdm(8) is feeding it
> invalid data.
> -- 

So we could file bugs against xdm, kdm, and gdm, and hope that they
change their manipulation of utmp, but as I stated in my original bug,
"who" gives some useful information about users logged in on X
sessions, presumably derived from utmp, so I'm guessing what we get
from utmp isn't about to change.

At the very least, as there seems to be agreement that this is a common
problem, could "w" be modified to first test whether a corresponding
entry exists in /dev for that "terminal", and if it does not, "w"
ignores that one?

I would actually wonder whether "w" should indeed print useful
information about each session (including non-terminal logins), to
give it parity with "who", but at least ignoring non-terminals would
workaround the error messages.



=====
MICHAEL WARDLE

MAIL   michael@endbracket.net
MOBILE +61-415-439-838
WWW    http://www.endbracket.net/michael/


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:01 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped