From: valdes@geosun.uchicago.edu (John Valdes)
Subject: Re: resetting pseudo-terminal sizes?
Organization: Department of the Geophysical Sciences, University of Chicago
Date: Thu, 23 Jul 1992 19:25:43 GMT

>
>>Say I start a shell
>>in a terminal window under a windowing system (X, Openwin or Sunview,
>>doesn't matter) and resize the window so that it's 132 colums x 50 lines.
>>Say also that this window uses /dev/ttyp3.  Now if exit the shell (an
>>hence quit the window, freeing the tty) and then remotely log into the
>>system so that my login uses /dev/ttyp3, the terminal size will still
>>be set to 132 cols by 50 lines!
>
>Didn't happen for me when I just tried it (SunOS 4.1.1, OW 2.0).

OK, I just tried to reproduce the results under OW 2.0 and 3.0, but it
didn't show up in with either version (SunOS 4.1.1, BTW).  I guess I 
was a bit rash including OW; I remember having the problem under Sunview,
and I'm currently experiencing it under X (from MIT, X11R4), so I assumed
the problem was present under OW also.

I have been able to reliable reproduce the results under X and Sunview,
but only under certain circumstances.  Here's what I do:

1)  Start up X or sunview

2)  In addition to whatever xterms or cmdtools (or shelltools) opened
    when you started X or sunview, respectively, open two more.  For
    example, say that you started X with two xterms which use /dev/ttyp0
    and /dev/ttyp1.  You want to open two more xterms so that they
    use ttyp2 and ttyp3.

3)  Resize the first of the two windows you opened in 1) (the xterm
    using ttyp2 in the example above).  stty -a should reflect the new size.

4)  Exit the window which you just resized (ttyp2)

5)  From any of the other windows (or from another machine), telnet
    into the machine so that your login uses the same ttyp used by
    the window you just resized and quit (ttyp2, in this example).

6)  If you now type stty -a, the number of rows and columns reported
    will match the size of the window you had just resized and quit.

Observations:

  Assume ttyp(n) is the ttyp which has be resized for the following:

  -I see this behavior only if ttyp(n+1) is in use.  For example, say
   ttyp0, ttyp1, ttyp2, ttyp3 and ttyp4 are in use.  This behavior
   won't be seen if ttyp4 is the one resized.  It will happen if ttyp2
   is the one resized.  ttyp(n-1) may also have to be in use, but I
   haven't tested this in all cases.  (Hey, I've got work to do!! (-: )

  -It seems that this only happens with even numbered ttyp's, but again
   I haven't tested this extensively.

BTW, I'm running my xterm's suid.  Does anyone else see this behavior?

>
>>but I would much prefer having the pseudo-terminal driver 
>>(re)size the terminal properly itself.
>
>The pseudo-tty driver can't resize it itself, as it has no idea what the
>right size is.  It can only do what the process on the master side tells
>it.

I guess I didn't express myself very well.  What I meant to say is that
I would prefer that, once a ttyp* is freed, the driver would either
set the number of lines and columns as undefined, or set them to 0
(which may be the same thing as undefined; I'm not that familiar with
the workings of the driver).

>There may have been a bug, in whatever version of the OS that you're
>running, that kept the resize from happening; what version are you
>using?

SunOS 4.1.1, MIT X11R4

John Valdes
valdes@geosun.uchicago.edu
Newsgroups: comp.sys.sun.admin