Subject: Re: xterm tty ownership
To: Christos Zoulas <christos@zoulas.com>
From: Gary Duzan <gary@duzan.org>
List: current-users
Date: 07/04/2007 12:23:30
In Message <20070704155830.91AB756407@rebar.astron.com> ,
   christos@zoulas.com (Christos Zoulas) wrote:

=>On Jul 4, 10:06am, gary@duzan.org (Gary Duzan) wrote:
=>-- Subject: Re: xterm tty ownership
=>
=>| In Message <20070704015039.720C956542@rebar.astron.com> ,
=>|    christos@zoulas.com (Christos Zoulas) wrote:
=>| 
=>| =>On Jul 3,  9:23pm, gary@duzan.org (Gary Duzan) wrote:
=>| =>-- Subject: Re: xterm tty ownership
=>| =>
=>| =>| In Message <f6dt3m$jnj$1@sea.gmane.org> ,
=>| =>|    christos@astron.com (Christos Zoulas) wrote:
=>| =>| 
=>| =>| =>In article <200707031140.l63BeOUo028090@wheel.duzan.org>,
=>| =>| =>Gary Duzan  <gary@duzan.org> wrote:
=>| =>| =>>   For a couple weeks I've been getting:
=>| =>| =>>
=>| =>| =>>utmp_update: /dev/ttyp?: Is not owned by you
=>| =>
=>| =>The ? is the real tty letter I take it [0-9a-f];
=>| 
=>|    Correct.
=>| 
=>| =>| -r-xr-xr-x  1 root  wheel  351522 Jul  1 13:09 /usr/X11R6/bin/xterm*
=>| =>| -r-sr-xr-x  1 root  wheel  11702 Jul  1 12:01 /usr/libexec/utmp_update*
=>| =>| 
=>| =>| =>Did you compile your kernel with COMPAT_BSDPTY?
=>| =>| 
=>| =>| options		COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
=>| =>| 
=>| =>| =>ls -l /dev/ptm*
| =>| 
=>| =>| crw-rw-rw-  1 root  wheel  165, 1 Dec  8  2004 /dev/ptm
=>| =>| crw-rw-rw-  1 root  wheel  165, 0 Dec  8  2004 /dev/ptmx
=>| =>| 
=>| =>|    If it helps, I am running with one big LFS for everything, I
=>| =>| have some debugging turned on in the kernel, and I'm running amd64.
=>| =>
=>| =>That all looks fine, but what is the permission of the pty before xterm
=>| =>opens it?
=>| 
=>| ===========================================================================
=>| capo { ~ } % ls -l /dev/?ty?? > foo
=>| capo { ~ } % xterm &
=>| [1] 5842
=>| capo { ~ } % ls -l /dev/?ty?? > bar
=>| capo { ~ } % 
=>| [1]    Done                          xterm
=>| capo { ~ } % ls -l /dev/?ty?? > blah
=>| capo { ~ } % diff foo bar
=>| 284c284
=>| < crw-rw-rw-  1 root  wheel    5,      7 Jul  4 09:57 /dev/ttyp7
=>| ---
=>| > crw-rw-rw-  1 root  wheel    5,      7 Jul  4 09:58 /dev/ttyp7
=>| capo { ~ } % diff bar blah
=>| 284c284
=>| < crw-rw-rw-  1 root  wheel    5,      7 Jul  4 09:58 /dev/ttyp7
=>| ---
=>| > crw-rw-rw-  1 root  wheel    5,      7 Jul  4 09:59 /dev/ttyp7
=>| capo { ~ } % 
=>| ===========================================================================
=>| 
=>|    ttyp7 was the tty for the xterm.
=>
=>Your xrerm is somehow not compiled to use the pty multiplexor. You can
=>verify this by ktracing the xterm.

   It looks like it is to me.

===========================================================================
 13377      1 xterm    CALL  open(0x438d23,2,0)
 13377      1 xterm    NAMI  "/dev/tty"
 13377      1 xterm    RET   open 4
 13377      1 xterm    CALL  setitimer(0,0x7f7fffffd130,0x7f7fffffd110)
 13377      1 xterm    RET   setitimer 0
 13377      1 xterm    CALL  __sigaction_sigtramp(SIGALRM,0x7f7fffffd130,0x7f7fffffd110,0x7f7ffbd7c31c,2)
 13377      1 xterm    RET   __sigaction_sigtramp 0
 13377      1 xterm    CALL  ioctl(4,TIOCGETA,0x7f7fffffe970)
 13377      1 xterm    GIO   fd 4 read 44 bytes
       "\^B\^C\0\0\a\0\0\0\0K\0\0\M-O\^E\0 \^D\M^?\M^?\^?\^W\^U\^R\M^?\^C\^\\
	\^Z\^Y\^Q\^S\^V\^O\^A\0\^T\M^?\0\M^V\0\0\0\M^V\0\0"
 13377      1 xterm    RET   ioctl 0
 13377      1 xterm    CALL  close(4)
 13377      1 xterm    RET   close 0
 13377      1 xterm    CALL  open(0x7f7ffc00ec24,2,0x54e000)
 13377      1 xterm    NAMI  "/dev/ptm"
 13377      1 xterm    RET   open 4
 13377      1 xterm    CALL  ioctl(4,TIOCPTMGET,0x7f7fffffd0a0)
 13377      1 xterm    NAMI  "/dev/ptyp9"
 13377      1 xterm    NAMI  "/dev/ttyp9"
 13377      1 xterm    NAMI  "/dev/ttyp9"
 13377      1 xterm    GIO   fd 4 read 40 bytes
       "\^E\0\0\0\^F\0\0\0/dev/ptyp9\0\0\0\0\0\0/dev/ttyp9\0\0\0\0\0\0"
 13377      1 xterm    RET   ioctl 0
 13377      1 xterm    CALL  close(4)
 13377      1 xterm    RET   close 0
===========================================================================

   I get the same thing on my 4.0 branch i386 box which isn't having
the problem.

					Gary Duzan