[comp.unix.internals] question about rlogin/window size

dave@boingo.med.jhu.edu (David Heath) (03/26/91)

I am using the rlogin program on dec ultrix 4.0 to rlogin into various
hosts. Rlogin uses the TIOCGWINSZ ioctl to find the window size and pass
it to the remote rlogind. This USUALLY works for me. However, it sometimes
doesn't and NEVER works when I run rlogin from a shell script rather than
typing in the rlogin command myself. It also does not handle the sigwinch
signal to change the window size. (On the remote system, stty size reports
'0 0'.)

I looked at the source code, and there is a procedure called oob() that
is the SIGURG handler. If it is called and receives a message TIOCPKT_WINDOW
from the remote socket, then it sends the window size and permits sigwinch's
to send the window size. As far as I can tell with dbx, this is never
happening.

If I put the following in the beginning of doit(), then it seems to work:
  sendwindow();
  dosigwinch = 1;
  signal (SIGWINCH, sigwinch);
This is what would be done by oob() when it received TIOCPKT_WINDOW.

Does anyone know exactly how this is supposed to work and why it doesn't
work in a shell script (or under dbx for that matter)? Also, is there
a fix?

Any help is appreciated.
-dave heath
dave@boingo.med.jhu.edu

torek@elf.ee.lbl.gov (Chris Torek) (03/27/91)

In article <1991Mar25.225654.22933@boingo.med.jhu.edu>
dave@boingo.med.jhu.edu (David Heath) writes:
>I am using the rlogin program on dec ultrix 4.0 to rlogin into various
>hosts. Rlogin uses the TIOCGWINSZ ioctl to find the window size and pass
>it to the remote rlogind. This USUALLY works for me. However, it sometimes
>doesn't and NEVER works when I run rlogin from a shell script rather than
>typing in the rlogin command myself. ...

Around August 1986, I put a fair amount of work into fixing the BSD
rlogin program.  It had several race conditions, among other problems.
If DEC have not picked up these fixes yet, that would explain the
problem.

Note that since rlogin uses `rcmd' and rcmd races with the SIGURG
handler, you must change rcmd as well.  In the version I ran on Sun
workstations I used the expedient of copying the library rcmd routine
into rlogin itself, and adding the missing F_SETOWN fcntl.

Those suffering with impoverished environments may be able to make
use of the BSD software found on uunet.  No statement of warranties
implied, etc., etc.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek@ee.lbl.gov